docs.unity3d.com
    Show / Hide Table of Contents

    Class SplineMesh

    Utility methods for creating and working with meshes.

    Inheritance
    Object
    SplineMesh
    Inherited Members
    Object.ToString()
    Object.Equals(Object)
    Object.Equals(Object, Object)
    Object.ReferenceEquals(Object, Object)
    Object.GetHashCode()
    Object.GetType()
    Object.MemberwiseClone()
    Namespace: UnityEngine.Splines
    Syntax
    public static class SplineMesh

    Methods

    Extrude<T>(T, Mesh, Single, Int32, Int32, Boolean)

    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.

    Single radius

    The radius of the extruded mesh.

    Int32 sides

    How many sides make up the radius of the mesh.

    Int32 segments

    How many sections compose the length of the mesh.

    Boolean 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, Single, Int32, Int32, Boolean, 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.

    Single radius

    The radius of the extruded mesh.

    Int32 sides

    How many sides make up the radius of the mesh.

    Int32 segments

    How many sections compose the length of the mesh.

    Boolean 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, Single, Int32, Single, Boolean, 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.

    Single radius

    The radius of the extruded mesh.

    Int32 sides

    How many sides make up the radius of the mesh.

    Single segmentsPerUnit

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

    Boolean 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>, Single, Int32, Int32, Boolean, 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.

    Single radius

    The radius of the extruded mesh.

    Int32 sides

    How many sides make up the radius of the mesh.

    Int32 segments

    How many sections compose the length of the mesh.

    Boolean 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(Int32, Int32, Boolean, Boolean, Vector2, out Int32, out Int32) to calculate the expected buffer sizes.

    ArgumentException

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

    GetVertexAndIndexCount(Int32, Int32, Boolean, Boolean, Vector2, out Int32, out Int32)

    Calculate the vertex and index count required for an extruded mesh. Use this method to allocate attribute and index buffers for use with Extrude.

    Declaration
    public static void GetVertexAndIndexCount(int sides, int segments, bool capped, bool closed, Vector2 range, out int vertexCount, out int indexCount)
    Parameters
    Type Name Description
    Int32 sides

    How many sides make up the radius of the mesh.

    Int32 segments

    How many sections compose the length of the mesh.

    Boolean capped

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

    Boolean closed

    Whether the extruded mesh is closed or open. This can be separate from the Spline.Closed value.

    Vector2 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.

    Int32 vertexCount

    The number of vertices required for an extruded mesh using the provided settings.

    Int32 indexCount

    The number of indices required for an extruded mesh using the provided settings.

    Back to top
    Terms of use
    Copyright © 2023 Unity Technologies — Terms of use
    • Legal
    • Privacy Policy
    • Cookies
    • Do Not Sell or Share My Personal Information
    • Your Privacy Choices (Cookie Settings)
    "Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
    Generated by DocFX on 18 October 2023