Table of Contents

Class NavMotor

Namespace
Trailblazer.Navigation.Motor
Assembly
Trailblazer.dll

Controls character movement using an acceleration-based approach in a deterministic, lockstep simulation.

public class NavMotor : IRecordable
Inheritance
NavMotor
Implements
IRecordable
Inherited Members

Remarks

This controller processes movement requests, applies forces such as gravity and platform adjustments, and finalizes traversal states for consistent movement across frames.

Constructors

NavMotor(TrailblazerWorldContext, TrekCondition, LocomotionProfile?)

Initializes a new context-bound NavMotor instance.

public NavMotor(TrailblazerWorldContext context, TrekCondition condition, LocomotionProfile? profile = null)

Parameters

context TrailblazerWorldContext
condition TrekCondition
profile LocomotionProfile

Fields

Events

Defines host interaction hooks for the NavMotor. These members are state notifications rather than behavior-gating query seams.

public NavMotorEvents Events

Field Value

NavMotorEvents

Properties

CurrentState

This stores the current _frameCondition for the frame.

public TransitState CurrentState { get; }

Property Value

TransitState

Remarks

This is set on OnInitialize(TrekCondition, LocomotionProfile?), can be explicitly synchronized before traversal through SyncTraversalState(TrekCondition, bool), and is refreshed at the end of the frame in FinalizeTraversal(Vector3d, Vector3d, FixedQuaternion, TrekCondition, Vector3d?).

FrameSlopeAngle

Stores the slope angle for the current frame based on Direction.

public Fixed64 FrameSlopeAngle { get; }

Property Value

Fixed64

Handler

public LocomotionHandler Handler { get; }

Property Value

LocomotionHandler

InLimbo

Checks if the object is in a state where it is airborne but not actively jumping, flying, or falling.

public bool InLimbo { get; }

Property Value

bool

IsClimbing

Determines if the object is currently attached to a climb affordance.

public bool IsClimbing { get; }

Property Value

bool

IsFalling

Gets a value indicating whether the object is currently falling.

public bool IsFalling { get; }

Property Value

bool

IsFlying

Determines if the object is currently under active flight control.

public bool IsFlying { get; }

Property Value

bool

IsInGas

Determines if the object is currently in the air.

public bool IsInGas { get; }

Property Value

bool

IsInLiquid

Determines if the object is currently in water.

public bool IsInLiquid { get; }

Property Value

bool

IsInitialized

Gets a value indicating whether the object has been initialized.

public bool IsInitialized { get; }

Property Value

bool

IsJumping

Determines if the object is currently in a jump state.

public bool IsJumping { get; }

Property Value

bool

IsOnSolid

Determines if the object is currently on the ground.

public bool IsOnSolid { get; }

Property Value

bool

StateChanged

Indicates if the traversal medium has changed since the last frame.

public bool StateChanged { get; }

Property Value

bool

TraversalInProgress

Indicates whether a traversal has started for the current frame and still requires finalization or abort.

public bool TraversalInProgress { get; }

Property Value

bool

WasInGas

Determines if the object was in the air in the previous frame.

public bool WasInGas { get; }

Property Value

bool

WasInLiquid

Determines if the object was in water in the previous frame.

public bool WasInLiquid { get; }

Property Value

bool

WasOnSolid

Determines if the object was on the ground in the previous frame.

public bool WasOnSolid { get; }

Property Value

bool

Methods

AbortTraversalFrame()

Clears the current traversal-finalization requirement without reconciling frame results.

public void AbortTraversalFrame()

Remarks

This is an explicit recovery escape hatch for hosts that must discard an in-progress traversal. It clears traversal bookkeeping only and does not roll back locomotion state changes that already occurred.

BindContext(TrailblazerWorldContext)

Binds this motor to a world context.

public void BindContext(TrailblazerWorldContext context)

Parameters

context TrailblazerWorldContext

ConfigureLocomotions(Action<LocomotionProfileBuilder>)

Reconfigures the currently installed locomotion profile from the active handler state.

public void ConfigureLocomotions(Action<LocomotionProfileBuilder> configure)

Parameters

configure Action<LocomotionProfileBuilder>

FinalizeTraversal(Vector3d, Vector3d, FixedQuaternion, TrekCondition, Vector3d?)

Finalizes traversal state updates and prepares the object for the next simulation frame.

public void FinalizeTraversal(Vector3d newPosition, Vector3d lastPosition, FixedQuaternion newRotation, TrekCondition conditonRefresh, Vector3d? newFootPosition = null)

Parameters

newPosition Vector3d
lastPosition Vector3d
newRotation FixedQuaternion
conditonRefresh TrekCondition
newFootPosition Vector3d?

Remarks

This method updates the frame velocity, applies necessary adjustments based on traversal state changes, and processes platform movement or environmental effects as needed.

GetMaxAcceleration()

Retrieves the maximum acceleration value based on the object’s current traversal state.

public Fixed64 GetMaxAcceleration()

Returns

Fixed64

The acceleration limit depending on whether the object is grounded, airborne, or swimming.

GetVerticalJumpSpeed()

Computes the vertical jump speed required to reach the desired jump height (apex).

public Fixed64 GetVerticalJumpSpeed()

Returns

Fixed64

The initial vertical velocity needed for the jump.

IsOnSlope(Fixed64)

Checks if the object is on a sloped surface that is not considered too steep.

public bool IsOnSlope(Fixed64 angle)

Parameters

angle Fixed64

Returns

bool

True if the object is on a valid slope; otherwise, false.

IsTooSteep(Fixed64)

Determines whether the current surface is too steep for normal movement.

public bool IsTooSteep(Fixed64 angle)

Parameters

angle Fixed64

Returns

bool

True if the slope exceeds the allowable incline; otherwise, false.

MaxHoritzontalSpeedInDirection(Vector3d, TrekRate)

Calculates the maximum allowable speed in a given movement direction.

public Fixed64 MaxHoritzontalSpeedInDirection(Vector3d desiredMovementDirection, TrekRate rate)

Parameters

desiredMovementDirection Vector3d

The movement direction to evaluate.

rate TrekRate

The rate that dictates the maximum speed allowed.

Returns

Fixed64

The maximum speed possible in the specified direction.

OnInitialize(TrekCondition, LocomotionProfile?)

Prepares the controller by linking it to the given object and setting initial state values.

public void OnInitialize(TrekCondition condition, LocomotionProfile? profile = null)

Parameters

condition TrekCondition

The initial traversal condition of the object

profile LocomotionProfile

Optional locomotion composition profile. When omitted, the default profile is used.

RecordData(IChronicler)

Records the current instance state to the provided chronicler.

public void RecordData(IChronicler chronicler)

Parameters

chronicler IChronicler

The active chronicler pass.

SetLocomotionProfile(LocomotionProfile)

Replaces the currently installed locomotion profile.

public void SetLocomotionProfile(LocomotionProfile profile)

Parameters

profile LocomotionProfile

SetVelocity(Vector3d)

Manually sets the object’s velocity, overriding the computed velocity for the next frame.

public void SetVelocity(Vector3d velocity)

Parameters

velocity Vector3d

The new velocity to assign to the object.

SyncTraversalState(TrekCondition, bool)

Pushes a traversal snapshot into the motor before the next traversal phase begins.

public void SyncTraversalState(TrekCondition newCondition, bool isInitializing = false)

Parameters

newCondition TrekCondition
isInitializing bool

Remarks

This is the explicit pre-traversal sync seam for hosts that learn about medium or surface changes before the next call to TryTraversal(TrekRequest, out Vector3d, out Vector3d, out FixedQuaternion).

TryTraversal(TrekRequest, out Vector3d, out Vector3d, out FixedQuaternion)

Processes a movement request and applies necessary forces.

public bool TryTraversal(TrekRequest request, out Vector3d velocityDelta, out Vector3d positionDelta, out FixedQuaternion rotationDelta)

Parameters

request TrekRequest

The movement request containing desired movement parameters

velocityDelta Vector3d

The resulting velocity change to apply to the object

positionDelta Vector3d

The resulting position change from platform movement to apply to the object

rotationDelta FixedQuaternion

The resulting rotation change from platform movement to apply to the object

Returns

bool

Remarks

This method opens a traversal phase for the current frame so duplicate force accumulation is rejected until the host calls FinalizeTraversal(Vector3d, Vector3d, FixedQuaternion, TrekCondition, Vector3d?) or AbortTraversalFrame(). Movement forces such as gravity, jump, and platform adjustments are applied.