WorldSplineGraph Class
Inherits: | Node |
This class is used to place prefab nodes along a spline graph.
A world spline graph consists of segments and has a list of prefab nodes (currently ObjectMeshStatic only) that can be stretched or tiled along the segments.
WorldSplineGraph has the following features:
- Vertices and segments of the spline graph are managed via the SplineGraph class.
- 2 modes are supported:
- stretching: prefab nodes are stretched along the spline segment.
- tiling: prefab nodes are duplicated along the spline segment.
- Forward axis selection for stretching/tiling prefab nodes.
WorldSplineGraph Class
Members
static WorldSplineGraph()
Default constructor. Creates an empty world spline graph.static WorldSplineGraph(string name)
Constructor. Creates an empty world spline graph with a given name.Arguments
- string name - World spline graph name.
static WorldSplineGraph cast(Node node)
Casts a WorldSplineGraph out of the Node instance.Arguments
- Node node - Node instance.
Return value
WorldSplineGraph instance.int isCurved()
Returns a value indicating if the world spline graph is curved.Return value
1 if the world spline graph is curved; otherwise, 0.void makeCurved()
Curves the world spline graph using its geodetic pivot. The spline file is saved upon completion of the curving operation.Notice
The world spline graph must be a child of a Geodetic Pivot node.
void makeFlat()
Flattens the world spline graph using its geodetic pivot. The spline file is saved upon completion of the flattening operation.Notice
The world spline graph must be a child of a Geodetic Pivot node.
void setMaxVisibleDistance(float distance)
Updates the maximum visibility distance of the world spline graph. It is the distance, starting from which the world spline graph becomes invisible.Arguments
- float distance - Distance, in units. The default value is inf.
float getMaxVisibleDistance()
Returns the maximum visibility distance of the world spline graph. It is the distance, starting from which the world spline graph becomes invisible.Return value
Distance, in units.void setMinVisibleDistance(float distance)
Updates the minimum visibility distance of the world spline graph. It is the distance, starting from which the world spline graph becomes visible.Arguments
- float distance - Distance, in units. The default value is -inf.
float getMinVisibleDistance()
Returns the minimum visibility distance of the world spline graph. It is the distance, starting from which the world spline graph becomes visible.Return value
Distance, in units.int getNumPoints()
Returns the total number of points in the world spline graph.Return value
Number of points.int getNumPrefabNodes()
Returns the total number of prefab nodes in the list.Return value
Number of prefab nodes.int getNumSegments()
Returns the total number of segments in the world spline graph.Return value
Number of segments.void setPoint(int index, vec3 point)
Sets the coordinates of the point with a given index.Arguments
- int index - Point index.
- vec3 point - Point coordinates.
vec3 getPoint(int index)
Returns the coordinates of the point with a given index.Arguments
- int index - Point index.
Return value
Point coordinates.int setPrefabForwardAxis(int num, int forward_axis)
Sets the forward axis for a given prefab node.Arguments
- int num - Prefab node index.
- int forward_axis - Forward axis. One of the FORWARD_* variables.
Return value
1 if the forward axis for the prefab node was set successfully; otherwise, 0.int getPrefabForwardAxis(int num)
Returns the forward axis for a given prefab node.Arguments
- int num - Prefab node index.
Return value
Forward axis. One of the FORWARD_* variables.string getPrefabNodeName(int num)
Returns the name of the prefab node with a given index.Arguments
- int num - Prefab node index.
Return value
Prefab node name.int getSegmentMode(int segment_index)
Returns the current mode for the secment with a given index.Arguments
- int segment_index - Segment index.
Return value
Mode. One of the SEGMENT_* variables.int getSegmentPrefabIndex(int segment_index)
Returns the index of the prefab node currently assigned to the segment with a given index.Arguments
- int segment_index - Segment index.
Return value
Prefab node index or -1 if no prefab node is assigned to the segment with a given index.int getSegmentStartPointIndex(int index)
Returns the index of the start point of the segment with a given index.Arguments
- int index - Segment index.
Return value
Segment start point index.int getSegmentEndPointIndex(int index)
Returns the index of the end point of the segment with a given index.Arguments
- int index - Segment index.
Return value
Segment end point index.vec3 getSegmentStartTangent(int index)
Returns the tangent coordinates for the start point of the segment with a given index.Arguments
- int index - Segment index.
Return value
Start point tangent coordinates.vec3 getSegmentEndTangent(int index)
Returns the tangent coordinates for the end point of the segment with a given index.Arguments
- int index - Segment index.
Return value
End point tangent coordinates.vec3 calcSegmentTangent(int index, float t)
Returns the tangent coordinates for the point on the given segment.Arguments
- int index - Segment index.
- float t - Position of the point on the segment, in increments of the segment's length normalized to 1.
Return value
Tangent coordinates for the point on the given segment.vec3 getSegmentStartPoint(int index)
Returns the coordinates of the start point for the segment with a given index.Arguments
- int index - Segment index.
Return value
Segment start point coordinates.vec3 getSegmentEndPoint(int index)
Returns the coordinates of the end point for the segment with a given index.Arguments
- int index - Segment index.
Return value
Segment end point coordinates.vec3 calcSegmentPoint(int index, float t)
Returns the coordinates of the point on the given segment.Arguments
- int index - Segment index.
- float t - Position of the point on the segment, in increments of the segment's length normalized to 1.
Return value
Coordinates of the point on the given segment.vec3 getSegmentStartUpVector(int index)
Returns the up-vector coordinates for the start point of the segment with a given index.Arguments
- int index - Segment index.
Return value
Start point up-vector coordinates.vec3 getSegmentEndUpVector(int index)
Returns the up-vector coordinates for the end point of the segment with a given index.Arguments
- int index - Segment index.
Return value
End point up-vector coordinates.vec3 calcSegmentUpVector(int index, float t)
Returns the up-vector coordinates for the point on the given segment.Arguments
- int index - Segment index.
- float t - Position of the point on the segment, in increments of the segment's length normalized to 1.
Return value
Up-vector coordinates for the point on the given segment.void setSplineGraph(SplineGraph splinegraph)
Sets the specified source spline graph as the current one.Arguments
- SplineGraph splinegraph - Source spline graph.
void getSplineGraph(SplineGraph splinegraph)
Copies current spline graph to the destination spline graph.Arguments
- SplineGraph splinegraph - Destination spline graph.
void setSplineGraphName(string name, int force_load = 0)
Sets the name of the world spline graph.Arguments
- string name - World spline graph name.
- int force_load - Force flag.
- If 1 is specified, the world spline graph will immediately loaded from a file.
- If 0 is specified, only the world spline graph name will be updated.
string getSplineGraphName()
Returns the name of the world spline graph.Return value
World spline graph name.int addPrefabNode(string name, int forward_axis = 0)
Adds a prefab node to the list.Arguments
- string name - Prefab node name.
- int forward_axis - Forward axis. One of the FORWARD_* variables. The default value is FORWARD_X.
Return value
1 if the prefab node was added successfully; otherwise, 0.int assignSegmentPrefab(int segment_index, int prefab_num, int mode = 0)
Assigns the specified prefab node to the given segment of the spline graph.Arguments
- int segment_index - Segment index.
- int prefab_num - Prefab node index.
- int mode - Mode. One of the SEGMENT_* variables.
Return value
1 if the prefab node was successfully assigned to the segment; otherwise, 0.void clear()
Clears the world spline graph.void clearSegmentPrefab(int segment_index = -1)
Removes the assigned prefab node from the segment with a given index.Arguments
- int segment_index - Segment index. If no segment index is specified, the method removes assigned prefab nodes from all segments.
int load(string name)
Loads a spline graph from the specified XML-file.Arguments
- string name - Name of the XML-file to load the spline graph from.
Return value
1 if the spline graph was successfully loaded; otherwise, 0.void removePrefabNode(int num)
Removes the prefab with a given index from the list. This method also removes all nodes of all segments linked to this prefab node and performs correction of prefab node indices for all segments.Arguments
- int num - Prefab node index.
static int type()
Returns the type of the node.Return value
WorldSplineGraph type identifier.int FORWARD_X
Description
X is a forward axis for stretching.int FORWARD_Y
Description
Y is a forward axis for stretching.int FORWARD_Z
Description
Z is a forward axis for stretching.int SEGMENT_STRETCH
Description
The prefab node is stretched along the segment.int SEGMENT_TILING
Description
The prefab node is duplicated along the segment.Last update: 2017-07-03
Help improve this article
Was this article helpful?
(or select a word/phrase and press Ctrl+Enter)