Game.CoursePos
Assembly:
Namespace: Game.Tools
Type: struct
Base: System.ValueType
Summary:
CoursePos is a plain data container (ECS-friendly struct) used to represent a point on a "course" (track/road/mesh course) in the game's toolset. It holds spatial information (position and rotation), elevation data, delta/progression along the course, split/mesh indexing and a set of flags describing the course position state. This struct is suitable for use in Unity Entities contexts (jobs, components, and native containers).
Fields
-
public Unity.Entities.Entity m_Entity
Reference to the ECS Entity associated with this course position. May be Entity.Null when not bound to a specific entity. -
public Unity.Mathematics.float3 m_Position
World-space position of the course point. Uses Unity.Mathematics.float3. -
public Unity.Mathematics.quaternion m_Rotation
Orientation at the course point. Uses Unity.Mathematics.quaternion. -
public Unity.Mathematics.float2 m_Elevation
Two-component elevation data. The exact semantics are context-dependent (for example it can store base and adjusted elevation, or elevation and slope sample), but it generally represents elevation-related values for this course point. -
public float m_CourseDelta
Distance or delta along the course relative to a reference point (e.g., previous sample or course start). Often used to accumulate progression along a path. -
public float m_SplitPosition
Position value used for splits/subdivisions of the course or mesh. Commonly interpreted as a normalized value (0..1) along a split segment, but exact interpretation depends on the calling code. -
public CoursePosFlags m_Flags
Bitmask flags describing the state of this course position (e.g., markers for start/end/special handling). CoursePosFlags is an enum elsewhere in the codebase. -
public int m_ParentMesh
Index or identifier of the parent mesh/segment associated with this course point. Usually -1 or a sentinel value when there is no parent mesh.
Properties
- None. This type exposes plain public fields and no properties.
Constructors
public CoursePos()
Implicit default constructor provided by C#. Fields will be default-initialized (Entity.Null, zero vectors, zero floats, default enum, zero index).
You can create and initialize instances manually in code or in jobs as needed.
Methods
- None declared on this struct.
Usage Example
using Unity.Entities;
using Unity.Mathematics;
using Game.Tools;
// create and populate a CoursePos
CoursePos cp = new CoursePos
{
m_Entity = Entity.Null,
m_Position = new float3(10f, 2.5f, -4f),
m_Rotation = quaternion.EulerXYZ(new float3(0f, math.radians(90f), 0f)),
m_Elevation = new float2(2.5f, 2.45f),
m_CourseDelta = 1.25f,
m_SplitPosition = 0.5f,
m_Flags = default, // set appropriate CoursePosFlags value as needed
m_ParentMesh = -1
};
// use cp in your systems, native arrays, or jobs