docs.unity3d.com
    Show / Hide Table of Contents

    Struct BezierKnot

    This struct contains position and tangent data for a knot. The Spline class stores a collection of BezierKnot that form a series of connected BezierCurve. Each knot contains a Position, Tangent In, and Tangent Out. When a Spline is not closed, the first and last knots will contain an extraneous tangent (in and out, respectively).

    Inherited Members
    Object.Equals(Object, Object)
    Object.ReferenceEquals(Object, Object)
    Object.GetType()
    Namespace: UnityEngine.Splines
    Syntax
    [Serializable]
    public struct BezierKnot : ISerializationCallbackReceiver, IEquatable<BezierKnot>

    Constructors

    BezierKnot(float3)

    Create a new BezierKnot struct.

    Declaration
    public BezierKnot(float3 position)
    Parameters
    Type Name Description
    float3 position

    The position of the knot relative to the spline.

    BezierKnot(float3, float3, float3, quaternion)

    Create a new BezierKnot struct.

    Declaration
    public BezierKnot(float3 position, float3 tangentIn, float3 tangentOut, quaternion rotation)
    Parameters
    Type Name Description
    float3 position

    The position of the knot relative to the spline.

    float3 tangentIn

    The leading tangent to this knot.

    float3 tangentOut

    The following tangent to this knot.

    quaternion rotation

    The rotation of the knot relative to the spline.

    Fields

    Position

    The position of the knot. On a cubic bezier curve, this is equivalent to P0 or P3, depending on whether this knot is forming the first or second control point of the curve.

    Declaration
    public float3 Position
    Field Value
    Type Description
    float3

    Rotation

    Rotation of the knot.

    Declaration
    public quaternion Rotation
    Field Value
    Type Description
    quaternion

    TangentIn

    The tangent leading into this knot. On a cubic bezier curve, this value is used to calculate P2 when used as the second knot in a curve.

    Declaration
    public float3 TangentIn
    Field Value
    Type Description
    float3

    TangentOut

    The tangent following this knot. On a cubic bezier curve, this value is used to calculate P1 when used as the first knot in a curve.

    Declaration
    public float3 TangentOut
    Field Value
    Type Description
    float3

    Methods

    Equals(Object)

    Compare against an object for equality.

    Declaration
    public override bool Equals(object obj)
    Parameters
    Type Name Description
    Object obj

    The object to compare against.

    Returns
    Type Description
    Boolean

    Returns true when obj is a BezierKnot and the values of each knot are identical.

    Overrides
    ValueType.Equals(Object)

    Equals(BezierKnot)

    Compare two knots for equality.

    Declaration
    public bool Equals(BezierKnot other)
    Parameters
    Type Name Description
    BezierKnot other

    The knot to compare against.

    Returns
    Type Description
    Boolean

    Returns true when the position, tangents, and rotation of each knot are identical.

    Implements
    IEquatable<T>.Equals(T)

    GetHashCode()

    Calculate a hash code for this knot.

    Declaration
    public override int GetHashCode()
    Returns
    Type Description
    Int32

    A hash code for the knot.

    Overrides
    ValueType.GetHashCode()

    OnAfterDeserialize()

    See ISerializationCallbackReceiver.

    Declaration
    public void OnAfterDeserialize()
    Implements
    ISerializationCallbackReceiver.OnAfterDeserialize()

    OnBeforeSerialize()

    See ISerializationCallbackReceiver.

    Declaration
    public void OnBeforeSerialize()
    Implements
    ISerializationCallbackReceiver.OnBeforeSerialize()

    ToString()

    Create a string with the values of this knot.

    Declaration
    public override string ToString()
    Returns
    Type Description
    String

    A summary of the values contained by this knot.

    Overrides
    ValueType.ToString()

    Transform(float4x4)

    Multiply the position and tangents by a matrix.

    Declaration
    public BezierKnot Transform(float4x4 matrix)
    Parameters
    Type Name Description
    float4x4 matrix

    The matrix to multiply.

    Returns
    Type Description
    BezierKnot

    A new BezierKnot multiplied by matrix.

    Operators

    Addition(BezierKnot, float3)

    Knot position addition. This operation only applies to the position, tangents and rotation are unmodified.

    Declaration
    public static BezierKnot operator +(BezierKnot knot, float3 rhs)
    Parameters
    Type Name Description
    BezierKnot knot

    The target knot.

    float3 rhs

    The value to add.

    Returns
    Type Description
    BezierKnot

    A new BezierKnot where position is the sum of knot.position and rhs.

    Subtraction(BezierKnot, float3)

    Knot position subtraction. This operation only applies to the position, tangents and rotation are unmodified.

    Declaration
    public static BezierKnot operator -(BezierKnot knot, float3 rhs)
    Parameters
    Type Name Description
    BezierKnot knot

    The target knot.

    float3 rhs

    The value to subtract.

    Returns
    Type Description
    BezierKnot

    A new BezierKnot where position is the sum of knot.position minus rhs.

    In This Article
    • Constructors
      • BezierKnot(float3)
      • BezierKnot(float3, float3, float3, quaternion)
    • Fields
      • Position
      • Rotation
      • TangentIn
      • TangentOut
    • Methods
      • Equals(Object)
      • Equals(BezierKnot)
      • GetHashCode()
      • OnAfterDeserialize()
      • OnBeforeSerialize()
      • ToString()
      • Transform(float4x4)
    • Operators
      • Addition(BezierKnot, float3)
      • Subtraction(BezierKnot, float3)
    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