This class contains the list of points that make up the spline. Lets you create, get and move those points.
More...
|
| Spline (Vector3 anchorPtPosition, Transform t=null) |
| Initializes the point list with two points in a horizontal line. More...
|
|
Vector3 | GetPointAt (int index, PointType type, Transform parentTransform=null) |
| Gets the position of an anchor or control point at a certain index. If a transform is passed, it converts the position into the local space of that transform More...
|
|
CurvePoint | GetPointsAt (int index) |
|
void | AddPoint (Vector3 anchorPtPosition) |
| Add points matching previous anchor point's right handle direction. If we're adding the first point, add control points in a vertial line. More...
|
|
void | RemovePoint (int pointindex) |
| Removes anchor point at certain index from list with its control points More...
|
|
void | AddPointToEnd () |
| Add a point to the end of the spline based on the previous point's right handle position. More...
|
|
void | InsertPoint (int index) |
| Inserts a point after the active point. Grabs the right control point of the previous point and the left one from the next point and puts the new anchor in the middle, with the control points pointing at these. More...
|
|
void | SetPointPosition (int pointIndex, PointType pointType, Vector3 newPositiion) |
| Change position of a certain point.When moving points, it makes sure that control points move with the anchor point and that they always form a tangent More...
|
|
Vector3 | GetPositionForTime (float time, Transform parentTransform) |
| Calculate the segment we're at and the position for the provided time. More...
|
|
Vector3 | GetFirstDerivative (Vector3 firstAnchor, Vector3 rightControl, Vector3 leftControl, Vector3 secondAnchor, float t) |
| Get first derivative of the points of a segment to get tangent at a certain point in time More...
|
|
Vector3 | GetVelocityForTime (float time, Transform parentTransform) |
| Calculate segment we're at and get tangent for the provided time More...
|
|
Vector3 | GetDirectionForTime (float time, Transform parentTransform) |
| Normalize the velocity vector to get a direction More...
|
|
|
int | TotalSegments [get] |
|
int | TotalPoints [get] |
|
This class contains the list of points that make up the spline. Lets you create, get and move those points.
◆ Spline()
Spline.Spline |
( |
Vector3 |
anchorPtPosition, |
|
|
Transform |
t = null |
|
) |
| |
Initializes the point list with two points in a horizontal line.
- Parameters
-
anchorPtPosition | The position to create the first point in. |
◆ AddPoint()
void Spline.AddPoint |
( |
Vector3 |
anchorPtPosition | ) |
|
Add points matching previous anchor point's right handle direction. If we're adding the first point, add control points in a vertial line.
- Parameters
-
anchorPtPosition | Position where the anchor point will be added |
◆ AddPointToEnd()
void Spline.AddPointToEnd |
( |
| ) |
|
Add a point to the end of the spline based on the previous point's right handle position.
◆ GetDirectionForTime()
Vector3 Spline.GetDirectionForTime |
( |
float |
time, |
|
|
Transform |
parentTransform |
|
) |
| |
Normalize the velocity vector to get a direction
- Parameters
-
time | Time for which to get the direction |
parentTransform | Convert to this transform's local space |
- Returns
◆ GetFirstDerivative()
Vector3 Spline.GetFirstDerivative |
( |
Vector3 |
firstAnchor, |
|
|
Vector3 |
rightControl, |
|
|
Vector3 |
leftControl, |
|
|
Vector3 |
secondAnchor, |
|
|
float |
t |
|
) |
| |
Get first derivative of the points of a segment to get tangent at a certain point in time
- Parameters
-
firstAnchor | First anchor of segment |
rightControl | Right Control Point of First Anchor |
leftControl | Left Control Point of Second Anchor |
secondAnchor | Second anchor of segment |
t | |
- Returns
◆ GetPointAt()
Vector3 Spline.GetPointAt |
( |
int |
index, |
|
|
PointType |
type, |
|
|
Transform |
parentTransform = null |
|
) |
| |
Gets the position of an anchor or control point at a certain index. If a transform is passed, it converts the position into the local space of that transform
- Parameters
-
index | Index of the point to fetch |
type | Wether it is an anchor, left control point or right control point |
- Returns
◆ GetPositionForTime()
Vector3 Spline.GetPositionForTime |
( |
float |
time, |
|
|
Transform |
parentTransform |
|
) |
| |
Calculate the segment we're at and the position for the provided time.
- Parameters
-
time | Point in time we want to get the position at [0-1] |
parentTransform | Convert to this transform's local space |
- Returns
◆ GetVelocityForTime()
Vector3 Spline.GetVelocityForTime |
( |
float |
time, |
|
|
Transform |
parentTransform |
|
) |
| |
Calculate segment we're at and get tangent for the provided time
- Parameters
-
time | Time for which to get the velocity [0-1] |
parentTransform | Convert to this transform's local space |
- Returns
◆ InsertPoint()
void Spline.InsertPoint |
( |
int |
index | ) |
|
Inserts a point after the active point. Grabs the right control point of the previous point and the left one from the next point and puts the new anchor in the middle, with the control points pointing at these.
- Parameters
-
index | Index where to insert the new point after |
◆ RemovePoint()
void Spline.RemovePoint |
( |
int |
pointindex | ) |
|
Removes anchor point at certain index from list with its control points
- Parameters
-
pointindex | Index of point to remove. |
◆ SetPointPosition()
void Spline.SetPointPosition |
( |
int |
pointIndex, |
|
|
PointType |
pointType, |
|
|
Vector3 |
newPositiion |
|
) |
| |
Change position of a certain point.When moving points, it makes sure that control points move with the anchor point and that they always form a tangent
- Anchor Point: Move control points with it
- Control Points: Move the other control point in the same direction as the one you're moving while keeping the distance.
- Parameters
-
pointIndex | Index of the point to move. |
pointType | Anchor, Control Left or Control Right. |
newPositiion | Target Position of the point. |
The documentation for this class was generated from the following file:
- C:/dev/Students/CH15/Pamela.Figueroa/Spline Editor/Assets/Scripts/SplineCreation/Spline.cs