Search Results for

    Show / Hide Table of Contents

    Class Spline

    Spline shape actor that defines spatial curve with utility functions for general purpose usage.

    Inheritance
    System.Object
    Object
    SceneObject
    Actor
    Spline
    Implements
    ISerializable
    Inherited Members
    Actor.SetLayerRecursive(Int32)
    Actor.SetLayerNameRecursive(String)
    Actor.HasTag()
    Actor.HasTag(Tag)
    Actor.HasTag(String)
    Actor.AddTag(Tag)
    Actor.AddTagRecursive(Tag)
    Actor.RemoveTag(Tag)
    Actor.SetParent(Actor, Boolean, Boolean)
    Actor.GetChild(Int32)
    Actor.GetChild(String)
    Actor.GetChild(Type)
    Actor.GetChildren(Type)
    Actor.DestroyChildren(Single)
    Actor.GetScript(Int32)
    Actor.GetScript(Type)
    Actor.GetScripts(Type)
    Actor.AddMovement(Vector3)
    Actor.AddMovement(Vector3, Quaternion)
    Actor.GetWorldToLocalMatrix(Matrix)
    Actor.GetLocalToWorldMatrix(Matrix)
    Actor.OnDebugDraw()
    Actor.OnDebugDrawSelected()
    Actor.GetPrefabRoot()
    Actor.FindActor(String)
    Actor.FindActor(Type, Boolean)
    Actor.FindActor(Type, String)
    Actor.FindActor(Type, Tag, Boolean)
    Actor.FindScript(Type)
    Actor.HasActorInHierarchy(Actor)
    Actor.HasActorInChildren(Actor)
    Actor.IntersectsItself(Ray, Single, Vector3)
    Actor.Intersects(Ray, Single, Vector3)
    Actor.LookAt(Vector3)
    Actor.LookAt(Vector3, Vector3)
    Actor.LookingAt(Vector3)
    Actor.LookingAt(Vector3, Vector3)
    Actor.ToBytes(Actor[])
    Actor.FromBytes(Byte[])
    Actor.FromBytes(Byte[], Dictionary<Guid, Guid>)
    Actor.TryGetSerializedObjectsIds(Byte[])
    Actor.ToJson()
    Actor.FromJson(String)
    Actor.Clone()
    Actor.OnEnable()
    Actor.OnDisable()
    Actor.OnParentChanged()
    Actor.OnTransformChanged()
    Actor.OnActiveChanged()
    Actor.OnActiveInTreeChanged()
    Actor.OnOrderInParentChanged()
    Actor.OnStaticFlagsChanged()
    Actor.OnLayerChanged()
    Actor.OnBeginPlay()
    Actor.OnEndPlay()
    Actor.AddStaticFlags(StaticFlags)
    Actor.RemoveStaticFlags(StaticFlags)
    Actor.SetStaticFlag(StaticFlags, Boolean)
    Actor.HasStaticFlag(StaticFlags)
    Actor.ResetLocalTransform()
    Actor.AddChild(Type)
    Actor.AddChild<T>()
    Actor.GetChild<T>()
    Actor.TryGetChild<T>(T)
    Actor.GetOrAddChild<T>()
    Actor.AddScript(Type)
    Actor.AddScript<T>()
    Actor.GetScript<T>()
    Actor.TryGetScript<T>(T)
    Actor.FindScript<T>()
    Actor.FindActor<T>(Boolean)
    Actor.FindActor<T>(String)
    Actor.FindActor<T>(Tag, Boolean)
    Actor.GetChildren<T>()
    Actor.GetScripts<T>()
    Actor.RotateAround(Vector3, Vector3, Single, Boolean)
    Actor.ToString()
    Actor.Children
    Actor.Tags
    Actor.Layer
    Actor.Name
    Actor.IsActive
    Actor.StaticFlags
    Actor.PerInstanceRandom
    Actor.LocalPosition
    Actor.LocalOrientation
    Actor.LocalScale
    Actor.Sphere
    Actor.Box
    Actor.BoxWithChildren
    Actor.EditorBox
    Actor.EditorBoxChildren
    Actor.HasContentLoaded
    Actor.IsPrefabRoot
    Actor.IsStatic
    Actor.IsTransformStatic
    Actor.WorldToLocalMatrix
    Actor.LocalToWorldMatrix
    SceneObject.SetParent(Actor, Boolean)
    SceneObject.LinkPrefab(Guid, Guid)
    SceneObject.BreakPrefabLink()
    SceneObject.GetNamePath(Char)
    SceneObject.IsDuringPlay
    SceneObject.HasParent
    SceneObject.HasPrefabLink
    SceneObject.PrefabID
    SceneObject.PrefabObjectID
    Object.__unmanagedPtr
    Object.__internalId
    Object.Finalize()
    Object.As<T>()
    Object.NewValue(Type)
    Object.New(String)
    Object.Find<T>(Guid, Boolean)
    Object.Find(Guid, Type, Boolean)
    Object.TryFind<T>(Guid)
    Object.TryFind(Guid, Type)
    Object.Destroy(Object, Single)
    Object.DestroyNow(Object)
    Object.Destroy<T>(T, Single)
    Object.Equals(Object)
    Object.GetUnmanagedPtr(Object)
    Object.GetUnmanagedInterface(Object, Type)
    Object.FromUnmanagedPtr(IntPtr)
    Object.MapObjectID(Guid)
    Object.RemapObjectID(Guid)
    Object.GetHashCode()
    Object.ID
    Object.TypeName
    Namespace: FlaxEngine
    Assembly: FlaxEngine.CSharp.dll
    Syntax
    [ActorContextMenu("New/Other/Spline")]
    [ActorToolbox("Other")]
    [Unmanaged]
    public class Spline : Actor, ISerializable

    Constructors

    Spline()

    Initializes a new instance of the Spline.

    Declaration
    public Spline()

    Properties

    IsLoop

    Whether to use spline as closed loop. In that case, ensure to place start and end at the same location.

    Declaration
    [EditorOrder(0)]
    [EditorDisplay("Spline", null)]
    [Unmanaged]
    public bool IsLoop { get; set; }
    Property Value
    System.Boolean

    SplineDuration

    Gets the total duration of the spline curve (time of the last point).

    Declaration
    [Unmanaged]
    public float SplineDuration { get; }
    Property Value
    System.Single

    SplineKeyframes

    Gets or sets the spline keyframes collection.

    Declaration
    [Unmanaged]
    [Tooltip("Spline keyframes collection.")]
    [EditorOrder(10)]
    [EditorDisplay("Spline", null)]
    [Collection(CanReorderItems = false)]
    public BezierCurve<Transform>.Keyframe[] SplineKeyframes { get; set; }
    Property Value
    BezierCurve.Keyframe<>[]

    SplineLength

    Gets the total length of the spline curve (distance between all the points).

    Declaration
    [Unmanaged]
    public float SplineLength { get; }
    Property Value
    System.Single

    SplinePointsCount

    Gets the amount of points in the spline.

    Declaration
    [Unmanaged]
    public int SplinePointsCount { get; }
    Property Value
    System.Int32

    Methods

    AddSplineLocalPoint(Transform, Boolean)

    Adds the point to the spline curve (at the end).

    Declaration
    [Unmanaged]
    public void AddSplineLocalPoint(Transform point, bool updateSpline = true)
    Parameters
    Transform point

    The transformation of the point to add to the curve (local-space).

    System.Boolean updateSpline

    True if update spline after adding the point, otherwise false.

    AddSplineLocalPoint(Vector3, Boolean)

    Adds the point to the spline curve (at the end).

    Declaration
    [Unmanaged]
    public void AddSplineLocalPoint(Vector3 point, bool updateSpline = true)
    Parameters
    Vector3 point

    The location of the point to add to the curve (local-space).

    System.Boolean updateSpline

    True if update spline after adding the point, otherwise false.

    AddSplinePoint(Transform, Boolean)

    Adds the point to the spline curve (at the end).

    Declaration
    [Unmanaged]
    public void AddSplinePoint(Transform point, bool updateSpline = true)
    Parameters
    Transform point

    The transformation of the point to add to the curve (world-space).

    System.Boolean updateSpline

    True if update spline after adding the point, otherwise false.

    AddSplinePoint(Vector3, Boolean)

    Adds the point to the spline curve (at the end).

    Declaration
    [Unmanaged]
    public void AddSplinePoint(Vector3 point, bool updateSpline = true)
    Parameters
    Vector3 point

    The location of the point to add to the curve (world-space).

    System.Boolean updateSpline

    True if update spline after editing the point, otherwise false.

    ClearSpline()

    Clears the spline to be empty.

    Declaration
    [Unmanaged]
    public void ClearSpline()

    GetSplineDirection(Single)

    Evaluates the spline curve direction (forward vector, aka position 1st derivative) at the given time in 3D (world-space).

    Declaration
    [Unmanaged]
    public Vector3 GetSplineDirection(float time)
    Parameters
    System.Single time

    The time value. Can be negative or larger than curve length (curve will loop or clamp).

    Returns
    Vector3

    The calculated curve direction (world-space).

    GetSplineKeyframe(Int32)

    Gets the spline keyframe.

    Declaration
    public BezierCurve<Transform>.Keyframe GetSplineKeyframe(int index)
    Parameters
    System.Int32 index

    The spline point index.

    Returns
    BezierCurve.Keyframe<>

    The keyframe.

    GetSplineLocalDirection(Single)

    Evaluates the spline curve direction (forward vector, aka position 1st derivative) at the given time in 3D (local-space).

    Declaration
    [Unmanaged]
    public Vector3 GetSplineLocalDirection(float time)
    Parameters
    System.Single time

    The time value. Can be negative or larger than curve length (curve will loop or clamp).

    Returns
    Vector3

    The calculated curve direction (local-space).

    GetSplineLocalOrientation(Single)

    Evaluates the spline curve at the given time and calculates the point rotation in 3D (local-space).

    Declaration
    [Unmanaged]
    public Quaternion GetSplineLocalOrientation(float time)
    Parameters
    System.Single time

    The time value. Can be negative or larger than curve length (curve will loop or clamp).

    Returns
    Quaternion

    The calculated curve point rotation (local-space).

    GetSplineLocalPoint(Int32)

    Evaluates the spline curve at the given index (local-space).

    Declaration
    [Unmanaged]
    public Vector3 GetSplineLocalPoint(int index)
    Parameters
    System.Int32 index

    The curve keyframe index. Zero-based, smaller than GetSplinePointsCount().

    Returns
    Vector3

    The curve point location (local-space).

    GetSplineLocalPoint(Single)

    Evaluates the spline curve at the given time and calculates the point location in 3D (local-space).

    Declaration
    [Unmanaged]
    public Vector3 GetSplineLocalPoint(float time)
    Parameters
    System.Single time

    The time value. Can be negative or larger than curve length (curve will loop or clamp).

    Returns
    Vector3

    The calculated curve point location (local-space).

    GetSplineLocalPoints(out Transform[])

    Gets the spline curve points list (local-space).

    Declaration
    [Unmanaged]
    public void GetSplineLocalPoints(out Transform[] points)
    Parameters
    Transform[] points

    The result points collection.

    GetSplineLocalPoints(out Vector3[])

    Gets the spline curve points list (local-space).

    Declaration
    [Unmanaged]
    public void GetSplineLocalPoints(out Vector3[] points)
    Parameters
    Vector3[] points

    The result points collection.

    GetSplineLocalScale(Single)

    Evaluates the spline curve at the given time and calculates the point scale in 3D (local-space).

    Declaration
    [Unmanaged]
    public Vector3 GetSplineLocalScale(float time)
    Parameters
    System.Single time

    The time value. Can be negative or larger than curve length (curve will loop or clamp).

    Returns
    Vector3

    The calculated curve point scale (local-space).

    GetSplineLocalTangent(Int32, Boolean)

    Gets the spline curve point tangent at the given index (local-space).

    Declaration
    [Unmanaged]
    public Transform GetSplineLocalTangent(int index, bool isIn)
    Parameters
    System.Int32 index

    The curve keyframe index. Zero-based, smaller than GetSplinePointsCount().

    System.Boolean isIn

    True if get arrive tangent, otherwise gets leave tangent (in or out).

    Returns
    Transform

    The transformation of the tangent to set (world-space).

    Remarks

    Tangents are stored relative to the curve point but this methods converts them to be in local-space of the actor.

    GetSplineLocalTransform(Int32)

    Evaluates the spline curve at the given index (local-space).

    Declaration
    [Unmanaged]
    public Transform GetSplineLocalTransform(int index)
    Parameters
    System.Int32 index

    The curve keyframe index. Zero-based, smaller than GetSplinePointsCount().

    Returns
    Transform

    The curve point transformation (local-space).

    GetSplineLocalTransform(Single)

    Evaluates the spline curve at the given time and calculates the transformation in 3D (local-space).

    Declaration
    [Unmanaged]
    public Transform GetSplineLocalTransform(float time)
    Parameters
    System.Single time

    The time value. Can be negative or larger than curve length (curve will loop or clamp).

    Returns
    Transform

    The calculated curve point transformation (local-space).

    GetSplineOrientation(Single)

    Evaluates the spline curve at the given time and calculates the point rotation in 3D (world-space).

    Declaration
    [Unmanaged]
    public Quaternion GetSplineOrientation(float time)
    Parameters
    System.Single time

    The time value. Can be negative or larger than curve length (curve will loop or clamp).

    Returns
    Quaternion

    The calculated curve point rotation (world-space).

    GetSplinePoint(Int32)

    Evaluates the spline curve at the given index (world-space).

    Declaration
    [Unmanaged]
    public Vector3 GetSplinePoint(int index)
    Parameters
    System.Int32 index

    The curve keyframe index. Zero-based, smaller than GetSplinePointsCount().

    Returns
    Vector3

    The curve point location (world-space).

    GetSplinePoint(Single)

    Evaluates the spline curve at the given time and calculates the point location in 3D (world-space).

    Declaration
    [Unmanaged]
    public Vector3 GetSplinePoint(float time)
    Parameters
    System.Single time

    The time value. Can be negative or larger than curve length (curve will loop or clamp).

    Returns
    Vector3

    The calculated curve point location (world-space).

    GetSplinePointClosestToPoint(Vector3)

    Calculates the closest point to the given location.

    Declaration
    [Unmanaged]
    public Vector3 GetSplinePointClosestToPoint(Vector3 point)
    Parameters
    Vector3 point

    The point in world-space to find the spline point that is closest to it.

    Returns
    Vector3

    The spline position.

    GetSplinePoints(out Transform[])

    Gets the spline curve points list (world-space).

    Declaration
    [Unmanaged]
    public void GetSplinePoints(out Transform[] points)
    Parameters
    Transform[] points

    The result points collection.

    GetSplinePoints(out Vector3[])

    Gets the spline curve points list (world-space).

    Declaration
    [Unmanaged]
    public void GetSplinePoints(out Vector3[] points)
    Parameters
    Vector3[] points

    The result points collection.

    GetSplineScale(Single)

    Evaluates the spline curve at the given time and calculates the point scale in 3D (world-space).

    Declaration
    [Unmanaged]
    public Vector3 GetSplineScale(float time)
    Parameters
    System.Single time

    The time value. Can be negative or larger than curve length (curve will loop or clamp).

    Returns
    Vector3

    The calculated curve point scale (world-space).

    GetSplineSegmentLength(Int32)

    Gets the length of the spline segment (distance between pair of two points).

    Declaration
    [Unmanaged]
    public float GetSplineSegmentLength(int index)
    Parameters
    System.Int32 index

    The index of the segment end index. Zero-based, smaller than GetSplinePointsCount().

    Returns
    System.Single

    The spline segment length.

    GetSplineTangent(Int32, Boolean)

    Gets the spline curve point tangent at the given index (world-space).

    Declaration
    [Unmanaged]
    public Transform GetSplineTangent(int index, bool isIn)
    Parameters
    System.Int32 index

    The curve keyframe index. Zero-based, smaller than GetSplinePointsCount().

    System.Boolean isIn

    True if get arrive tangent, otherwise gets leave tangent (in or out).

    Returns
    Transform

    The transformation of the tangent to set (world-space).

    Remarks

    Tangents are stored relative to the curve point but this methods converts them to be in world-space.

    GetSplineTime(Int32)

    Gets the time of the spline keyframe.

    Declaration
    [Unmanaged]
    public float GetSplineTime(int index)
    Parameters
    System.Int32 index

    The curve keyframe index. Zero-based, smaller than GetSplinePointsCount().

    Returns
    System.Single

    The spline time.

    GetSplineTimeClosestToPoint(Vector3)

    Calculates the closest point to the given location and returns the spline time at that point.

    Declaration
    [Unmanaged]
    public float GetSplineTimeClosestToPoint(Vector3 point)
    Parameters
    Vector3 point

    The point in world-space to find the spline point that is closest to it.

    Returns
    System.Single

    The spline time.

    GetSplineTransform(Int32)

    Evaluates the spline curve at the given index (world-space).

    Declaration
    [Unmanaged]
    public Transform GetSplineTransform(int index)
    Parameters
    System.Int32 index

    The curve keyframe index. Zero-based, smaller than GetSplinePointsCount().

    Returns
    Transform

    The curve point transformation (world-space).

    GetSplineTransform(Single)

    Evaluates the spline curve at the given time and calculates the transformation in 3D (world-space).

    Declaration
    [Unmanaged]
    public Transform GetSplineTransform(float time)
    Parameters
    System.Single time

    The time value. Can be negative or larger than curve length (curve will loop or clamp).

    Returns
    Transform

    The calculated curve point transformation (world-space).

    InsertSplineLocalPoint(Int32, Single, Transform, Boolean)

    Inserts the spline curve point at the given index (local-space).

    Declaration
    [Unmanaged]
    public void InsertSplineLocalPoint(int index, float time, Transform point, bool updateSpline = true)
    Parameters
    System.Int32 index

    The curve keyframe index. Zero-based, smaller than GetSplinePointsCount().

    System.Single time

    The time value.

    Transform point

    The location of the point to add to the curve (local-space).

    System.Boolean updateSpline

    True if update spline after removing the point, otherwise false.

    InsertSplinePoint(Int32, Single, Transform, Boolean)

    Inserts the spline curve point at the given index (world-space).

    Declaration
    [Unmanaged]
    public void InsertSplinePoint(int index, float time, Transform point, bool updateSpline = true)
    Parameters
    System.Int32 index

    The curve keyframe index. Zero-based, smaller than GetSplinePointsCount().

    System.Single time

    The time value.

    Transform point

    The location of the point to add to the curve (world-space).

    System.Boolean updateSpline

    True if update spline after removing the point, otherwise false.

    RemoveSplinePoint(Int32, Boolean)

    Removes the spline curve point at the given index.

    Declaration
    [Unmanaged]
    public void RemoveSplinePoint(int index, bool updateSpline = true)
    Parameters
    System.Int32 index

    The curve keyframe index. Zero-based, smaller than GetSplinePointsCount().

    System.Boolean updateSpline

    True if update spline after removing the point, otherwise false.

    SetSplineKeyframe(Int32, BezierCurve<Transform>.Keyframe)

    Sets the spline keyframe.

    Declaration
    public void SetSplineKeyframe(int index, BezierCurve<Transform>.Keyframe keyframe)
    Parameters
    System.Int32 index

    The spline point index.

    BezierCurve.Keyframe<> keyframe

    The keyframe.

    SetSplineLocalPoint(Int32, Vector3, Boolean)

    Sets the spline curve at the given index (local-space).

    Declaration
    [Unmanaged]
    public void SetSplineLocalPoint(int index, Vector3 point, bool updateSpline = true)
    Parameters
    System.Int32 index

    The curve keyframe index. Zero-based, smaller than GetSplinePointsCount().

    Vector3 point

    The location of the point to set (local-space).

    System.Boolean updateSpline

    True if update spline after editing the point, otherwise false.

    SetSplineLocalTangent(Int32, Transform, Boolean, Boolean)

    Sets the spline curve point tangent at the given index (local-space).

    Declaration
    [Unmanaged]
    public void SetSplineLocalTangent(int index, Transform point, bool isIn, bool updateSpline = true)
    Parameters
    System.Int32 index

    The curve keyframe index. Zero-based, smaller than GetSplinePointsCount().

    Transform point

    The transformation of the tangent to set (local-space).

    System.Boolean isIn

    True if set arrive tangent, otherwise sets leave tangent (in or out).

    System.Boolean updateSpline

    True if update spline after editing the point, otherwise false.

    Remarks

    Tangents are stored relative to the curve point but this methods converts them to be in local-space of the actor.

    SetSplineLocalTransform(Int32, Transform, Boolean)

    Sets the spline curve at the given index (local-space).

    Declaration
    [Unmanaged]
    public void SetSplineLocalTransform(int index, Transform point, bool updateSpline = true)
    Parameters
    System.Int32 index

    The curve keyframe index. Zero-based, smaller than GetSplinePointsCount().

    Transform point

    The transformation of the point to set (local-space).

    System.Boolean updateSpline

    True if update spline after editing the point, otherwise false.

    SetSplinePoint(Int32, Vector3, Boolean)

    Sets the spline curve at the given index (world-space).

    Declaration
    [Unmanaged]
    public void SetSplinePoint(int index, Vector3 point, bool updateSpline = true)
    Parameters
    System.Int32 index

    The curve keyframe index. Zero-based, smaller than GetSplinePointsCount().

    Vector3 point

    The location of the point to set (world-space).

    System.Boolean updateSpline

    True if update spline after editing the point, otherwise false.

    SetSplinePointTime(Int32, Single, Boolean)

    Sets the spline curve point time at the given index (world-space).

    Declaration
    [Unmanaged]
    public void SetSplinePointTime(int index, float time, bool updateSpline = true)
    Parameters
    System.Int32 index

    The curve keyframe index. Zero-based, smaller than GetSplinePointsCount().

    System.Single time

    The time to set.

    System.Boolean updateSpline

    True if update spline after editing the point, otherwise false.

    SetSplineTangent(Int32, Transform, Boolean, Boolean)

    Sets the spline curve point tangent at the given index (world-space).

    Declaration
    [Unmanaged]
    public void SetSplineTangent(int index, Transform point, bool isIn, bool updateSpline = true)
    Parameters
    System.Int32 index

    The curve keyframe index. Zero-based, smaller than GetSplinePointsCount().

    Transform point

    The transformation of the tangent to set (world-space).

    System.Boolean isIn

    True if set arrive tangent, otherwise sets leave tangent (in or out).

    System.Boolean updateSpline

    True if update spline after editing the point, otherwise false.

    Remarks

    Tangents are stored relative to the curve point but this methods converts them to be in world-space.

    SetSplineTransform(Int32, Transform, Boolean)

    Sets the spline curve at the given index (world-space).

    Declaration
    [Unmanaged]
    public void SetSplineTransform(int index, Transform point, bool updateSpline = true)
    Parameters
    System.Int32 index

    The curve keyframe index. Zero-based, smaller than GetSplinePointsCount().

    Transform point

    The transformation of the point to set (world-space).

    System.Boolean updateSpline

    True if update spline after editing the point, otherwise false.

    SetTangentsLinear()

    Updates the curve tangent points to make curve linear.

    Declaration
    [Unmanaged]
    public void SetTangentsLinear()

    SetTangentsSmooth()

    Updates the curve tangent points to make curve smooth.

    Declaration
    [Unmanaged]
    public void SetTangentsSmooth()

    UpdateSpline()

    Updates the spline after it was modified. Recreates the collision and/or any cached state that depends on the spline type.

    Declaration
    [Unmanaged]
    public virtual void UpdateSpline()

    Events

    SplineUpdated

    Called when spline gets updated (eg. after curve modification).

    Declaration
    [Unmanaged]
    public event Action SplineUpdated
    Event Type
    System.Action

    Extension Methods

    Extensions.ReflectiveCompare<T>(T, T)
    Extensions.DeepClone<T>(T)
    Extensions.RawClone<T>(T)
    In This Article
    Back to top Copyright © 2012-2024 Wojciech Figat