Skip to main content

PresetWayPointPath

A class in Root.Township, the global namespace.

Server: a fixed path of positions and rotations that other code can sample by distance, through IPositionRotationPath.

Constructors​

MemberWhat it is
PresetWayPointPath()Unity makes components itself; use AddComponent or spawn a prefab instead of new.

Fields​

4 private and internal fields
MemberWhat it is
private float[] lengthsLength of each segment. Null until set up.
private Vector3[] localPositionsPath points. Local in the inspector, overwritten with world positions on setup.
private Quaternion[] localRotationsPath rotations. Local in the inspector, overwritten with world rotations on setup.
private float totalDistanceTotal path length.

Methods​

MemberWhat it is
override void InitializeAsServer(SpawnData spawnData)Server: converts the points to world space and measures the path.
2 private and internal methods
MemberWhat it is
private void IPositionRotationPath.GetPosition(float value, out Vector3 position, out Quaternion rotation, bool isNormalized)Returns the position and rotation at a distance along the path, or at a 0 to 1 fraction if normalized.
private void Setup()Turns the local points into world points and works out each segment's length and the total.