Table of Contents

Class NavTurning

Namespace
Trailblazer.Navigation.Turning
Assembly
Trailblazer.dll

The Turn class manages the character's rotation and turning functionality.

public class NavTurning : IRecordable
Inheritance
NavTurning
Implements
IRecordable
Inherited Members

Constructors

NavTurning(TrailblazerWorldContext, Fixed64)

Constructs and immediately initializes a context-bound NavTurning.

public NavTurning(TrailblazerWorldContext context, Fixed64 radius)

Parameters

context TrailblazerWorldContext
radius Fixed64

Fields

CanTurn

Whether this turning controller is currently allowed to perform turns.

public bool CanTurn

Field Value

bool

DefaultTurnRate

Represents the default turn rate value used for rotation calculations.

public static readonly Fixed64 DefaultTurnRate

Field Value

Fixed64

Remarks

This value is typically used as a standard or baseline turn rate in movement or rotation logic. The specific value is one eighth of a full rotation, which may correspond to 45 degrees if a full rotation is considered 360 degrees.

TurnRate

The base turn rate, controlling how much rotation is applied per simulation step.

public Fixed64 TurnRate

Field Value

Fixed64

Properties

CanTurnOnCollision

Optional predicate that determines whether an auto-turn is permitted after a collision.

public Func<bool>? CanTurnOnCollision { get; set; }

Property Value

Func<bool>

TargetReached

Indicates whether the current turn operation has completed (i.e., the target rotation has been reached).

public bool TargetReached { get; }

Property Value

bool

TargetRotation

The desired target rotation quaternion that the object is turning toward.

public FixedQuaternion TargetRotation { get; }

Property Value

FixedQuaternion

Methods

BindContext(TrailblazerWorldContext)

Binds this turning controller to a world context.

public void BindContext(TrailblazerWorldContext context)

Parameters

context TrailblazerWorldContext

NeedsTurn(Vector3d, Vector3d, Fixed64?)

Determines whether the angular difference between the current forward and a desired target direction exceeds the minimum threshold.

public static bool NeedsTurn(Vector3d currentForward, Vector3d targetDirection, Fixed64? minAngle = null)

Parameters

currentForward Vector3d
targetDirection Vector3d
minAngle Fixed64?

Returns

bool

NotifyCollision()

Signals that a collision has occurred and an auto-turn should be evaluated on the next call to TrySimulateTurn(Vector3d, Vector3d, Vector3d, FixedQuaternion, out FixedQuaternion).

public void NotifyCollision()

RecordData(IChronicler)

Records the current instance state to the provided chronicler.

public void RecordData(IChronicler chronicler)

Parameters

chronicler IChronicler

The active chronicler pass.

RequestTurnDirection(Vector3d, Vector3d, Fixed64?)

Buffers a new turn request toward the given target direction if the required angle exceeds the minimum threshold.

public void RequestTurnDirection(Vector3d curDirection, Vector3d targetDirection, Fixed64? interpolation = null)

Parameters

curDirection Vector3d
targetDirection Vector3d
interpolation Fixed64?

StopTurn()

Marks the current turn operation as complete, allowing new turns to be requested.

public void StopTurn()

TrySimulateTurn(Vector3d, Vector3d, Vector3d, FixedQuaternion, out FixedQuaternion)

Advances the object’s rotation toward the TargetRotation, handling both buffered and auto-turn logic.

public bool TrySimulateTurn(Vector3d position, Vector3d lastPosition, Vector3d forward, FixedQuaternion rotation, out FixedQuaternion appliedRotation)

Parameters

position Vector3d
lastPosition Vector3d
forward Vector3d
rotation FixedQuaternion
appliedRotation FixedQuaternion

Returns

bool