docs.unity3d.com
Search Results for

    Show / Hide Table of Contents

    Method Extrude

    Extrude<T>(T, Mesh, float, int, int, bool)

    Extrude a mesh along a spline in a tube-like shape.

    Declaration
    public static void Extrude<T>(T spline, Mesh mesh, float radius, int sides, int segments, bool capped = true) where T : ISpline
    Parameters
    Type Name Description
    T spline

    The spline to extrude.

    Mesh mesh

    A mesh that will be cleared and filled with vertex data for the shape.

    float radius

    The radius of the extruded mesh.

    int sides

    How many sides make up the radius of the mesh.

    int segments

    How many sections compose the length of the mesh.

    bool capped

    Whether the start and end of the mesh is filled. This setting is ignored when spline is closed.

    Type Parameters
    Name Description
    T

    A type implementing ISpline.

    Extrude<T>(T, Mesh, float, int, int, bool, float2)

    Extrude a mesh along a spline in a tube-like shape.

    Declaration
    public static void Extrude<T>(T spline, Mesh mesh, float radius, int sides, int segments, bool capped, float2 range) where T : ISpline
    Parameters
    Type Name Description
    T spline

    The spline to extrude.

    Mesh mesh

    A mesh that will be cleared and filled with vertex data for the shape.

    float radius

    The radius of the extruded mesh.

    int sides

    How many sides make up the radius of the mesh.

    int segments

    How many sections compose the length of the mesh.

    bool capped

    Whether the start and end of the mesh is filled. This setting is ignored when spline is closed.

    float2 range

    The section of the Spline to extrude. This value expects a normalized interpolation start and end. I.e., [0,1] is the entire Spline, whereas [.5, 1] is the last half of the Spline.

    Type Parameters
    Name Description
    T

    A type implementing ISpline.

    Extrude<T>(IReadOnlyList<T>, Mesh, float, int, float, bool, float2)

    Extrude a mesh along a list of splines in a tube-like shape.

    Declaration
    public static void Extrude<T>(IReadOnlyList<T> splines, Mesh mesh, float radius, int sides, float segmentsPerUnit, bool capped, float2 range) where T : ISpline
    Parameters
    Type Name Description
    IReadOnlyList<T> splines

    The splines to extrude.

    Mesh mesh

    A mesh that will be cleared and filled with vertex data for the shape.

    float radius

    The radius of the extruded mesh.

    int sides

    How many sides make up the radius of the mesh.

    float segmentsPerUnit

    The number of edge loops that comprise the length of one unit of the mesh.

    bool capped

    Whether the start and end of the mesh is filled. This setting is ignored when spline is closed.

    float2 range

    The section of the Spline to extrude. This value expects a normalized interpolation start and end. I.e., [0,1] is the entire Spline, whereas [.5, 1] is the last half of the Spline.

    Type Parameters
    Name Description
    T

    A type implementing ISpline.

    Extrude<TSplineType, TVertexType, TIndexType>(TSplineType, NativeArray<TVertexType>, NativeArray<TIndexType>, float, int, int, bool, float2)

    Extrude a mesh along a spline in a tube-like shape.

    Declaration
    public static void Extrude<TSplineType, TVertexType, TIndexType>(TSplineType spline, NativeArray<TVertexType> vertices, NativeArray<TIndexType> indices, float radius, int sides, int segments, bool capped, float2 range) where TSplineType : ISpline where TVertexType : struct, SplineMesh.ISplineVertexData where TIndexType : struct
    Parameters
    Type Name Description
    TSplineType spline

    The spline to extrude.

    NativeArray<TVertexType> vertices

    A pre-allocated buffer of vertex data.

    NativeArray<TIndexType> indices

    A pre-allocated index buffer. Must be of type UInt16 or UInt32.

    float radius

    The radius of the extruded mesh.

    int sides

    How many sides make up the radius of the mesh.

    int segments

    How many sections compose the length of the mesh.

    bool capped

    Whether the start and end of the mesh is filled. This setting is ignored when spline is closed.

    float2 range

    The section of the Spline to extrude. This value expects a normalized interpolation start and end. I.e., [0,1] is the entire Spline, whereas [.5, 1] is the last half of the Spline.

    Type Parameters
    Name Description
    TSplineType

    A type implementing ISpline.

    TVertexType

    A type implementing ISplineVertexData.

    TIndexType

    The mesh index format. Must be UInt16 or UInt32.

    Exceptions
    Type Condition
    ArgumentOutOfRangeException

    An out of range exception is thrown if the vertex or index buffer lengths do not match the expected size. Use GetVertexAndIndexCount(int, int, bool, bool, Vector2, out int, out int) to calculate the expected buffer sizes.

    ArgumentException

    An argument exception is thrown if {TIndexType} is not UInt16 or UInt32.

    In This Article
    Back to top
    Copyright © 2024 Unity Technologies — Trademarks and terms of use
    • Legal
    • Privacy Policy
    • Cookie Policy
    • Do Not Sell or Share My Personal Information
    • Your Privacy Choices (Cookie Settings)