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
contextTrailblazerWorldContextconditionTrekConditionprofileLocomotionProfile
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
Properties
CurrentState
This stores the current _frameCondition for the frame.
public TransitState CurrentState { get; }
Property Value
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
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
IsClimbing
Determines if the object is currently attached to a climb affordance.
public bool IsClimbing { get; }
Property Value
IsFalling
Gets a value indicating whether the object is currently falling.
public bool IsFalling { get; }
Property Value
IsFlying
Determines if the object is currently under active flight control.
public bool IsFlying { get; }
Property Value
IsInGas
Determines if the object is currently in the air.
public bool IsInGas { get; }
Property Value
IsInLiquid
Determines if the object is currently in water.
public bool IsInLiquid { get; }
Property Value
IsInitialized
Gets a value indicating whether the object has been initialized.
public bool IsInitialized { get; }
Property Value
IsJumping
Determines if the object is currently in a jump state.
public bool IsJumping { get; }
Property Value
IsOnSolid
Determines if the object is currently on the ground.
public bool IsOnSolid { get; }
Property Value
StateChanged
Indicates if the traversal medium has changed since the last frame.
public bool StateChanged { get; }
Property Value
TraversalInProgress
Indicates whether a traversal has started for the current frame and still requires finalization or abort.
public bool TraversalInProgress { get; }
Property Value
WasInGas
Determines if the object was in the air in the previous frame.
public bool WasInGas { get; }
Property Value
WasInLiquid
Determines if the object was in water in the previous frame.
public bool WasInLiquid { get; }
Property Value
WasOnSolid
Determines if the object was on the ground in the previous frame.
public bool WasOnSolid { get; }
Property Value
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
contextTrailblazerWorldContext
ConfigureLocomotions(Action<LocomotionProfileBuilder>)
Reconfigures the currently installed locomotion profile from the active handler state.
public void ConfigureLocomotions(Action<LocomotionProfileBuilder> configure)
Parameters
configureAction<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
newPositionVector3dlastPositionVector3dnewRotationFixedQuaternionconditonRefreshTrekConditionnewFootPositionVector3d?
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
angleFixed64
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
angleFixed64
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
desiredMovementDirectionVector3dThe movement direction to evaluate.
rateTrekRateThe 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
conditionTrekConditionThe initial traversal condition of the object
profileLocomotionProfileOptional 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
chroniclerIChroniclerThe active chronicler pass.
SetLocomotionProfile(LocomotionProfile)
Replaces the currently installed locomotion profile.
public void SetLocomotionProfile(LocomotionProfile profile)
Parameters
profileLocomotionProfile
SetVelocity(Vector3d)
Manually sets the object’s velocity, overriding the computed velocity for the next frame.
public void SetVelocity(Vector3d velocity)
Parameters
velocityVector3dThe 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
newConditionTrekConditionisInitializingbool
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
requestTrekRequestThe movement request containing desired movement parameters
velocityDeltaVector3dThe resulting velocity change to apply to the object
positionDeltaVector3dThe resulting position change from platform movement to apply to the object
rotationDeltaFixedQuaternionThe resulting rotation change from platform movement to apply to the object
Returns
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.