Table of Contents

Class CurvyShape

Base class for CurvyShape components

[RequireComponent(typeof(CurvySpline))]
[ExecuteAlways]
public class CurvyShape : DTVersionedMonoBehaviour
Inheritance
Object
Component
Behaviour
MonoBehaviour
DTVersionedMonoBehaviour
CurvyShape
Derived

Fields

Dirty

[NonSerialized]
public bool Dirty

Field Value

bool

Properties

Plane

Gets or sets the plane to create the shape in.

public CurvyPlane Plane { get; set; }

Property Value

CurvyPlane

Spline

Gets the attached spline

public CurvySpline Spline { get; }

Property Value

CurvySpline

Methods

ApplyShape()

Override this to add custom code

protected virtual void ApplyShape()

Delete()

Remove the CurvyShape component from it's GameObject

public void Delete()

PrepareControlPoints(int)

Resizes the spline to have a certain number of Control Points

protected void PrepareControlPoints(int count)

Parameters

count int

number of Control Points

PrepareSpline(CurvyInterpolation, CurvyOrientation, int, bool)

Sets basic spline parameters

protected void PrepareSpline(CurvyInterpolation interpolation, CurvyOrientation orientation = CurvyOrientation.Dynamic, int cachedensity = 50, bool closed = true)

Parameters

interpolation CurvyInterpolation
orientation CurvyOrientation
cachedensity int
closed bool

Refresh()

Called to refresh the shape. Please call base.Refresh() or RefreshSpline() after your custom code!

public void Refresh()

Remarks

Warning: Only work with ControlPoints, not with segments

SetBezierHandles(int, float)

Sets a Control Point's Bezier Handles by index

protected void SetBezierHandles(int no, float distanceFrag)

Parameters

no int

Control point index

distanceFrag float

distance in percent

SetBezierHandles(int, float, float)

Sets a Control Point's Bezier Handles by index

protected void SetBezierHandles(int no, float inDistanceFrag, float outDistanceFrag)

Parameters

no int

Control point index

inDistanceFrag float

distance in percent for HandleIn

outDistanceFrag float

distance in percent for HandleOut

SetBezierHandles(int, Vector3, Vector3, Space)

Sets a Control Point's Bezier Handles position

protected void SetBezierHandles(int no, Vector3 i, Vector3 o, Space space = Space.World)

Parameters

no int

the ControlPoint

i Vector3

HandlInPosition

o Vector3

HandleOutPosition

space Space

World or local space

SetBezierHandles(float, bool, bool, params CurvySplineSegment[])

Automatically place Bezier handles for a set of Control Points

public static void SetBezierHandles(float distanceFrag, bool setIn, bool setOut, params CurvySplineSegment[] controlPoints)

Parameters

distanceFrag float

how much % distance between neighbouring CPs are applied to the handle length?

setIn bool

Set HandleIn?

setOut bool

Set HandleOut?

controlPoints CurvySplineSegment[]

one or more Control Points to set

SetCGHardEdges(params int[])

Enables CGHardEdge for a set of Control Points

protected void SetCGHardEdges(params int[] controlPoints)

Parameters

controlPoints int[]

list of Control Point indices

SetPosition(int, Vector3)

Sets a Control Point's position by index

protected void SetPosition(int no, Vector3 position)

Parameters

no int

Control point index

position Vector3

local position

SetRotation(int, Quaternion)

Sets a Control Point's rotation by index

protected void SetRotation(int no, Quaternion rotation)

Parameters

no int

Control point index

rotation Quaternion

local rotation