Class PlatformLocomotion
- Namespace
- Trailblazer.Navigation.Motor
- Assembly
- Trailblazer.dll
Handles movement adjustments when the scout is standing on a moving platform or surface.
public class PlatformLocomotion : ILocomotion, ITransient, IRecordable
- Inheritance
-
PlatformLocomotion
- Implements
-
IRecordable
- Inherited Members
- Extension Methods
Remarks
This locomotion system tracks platform velocity, rotation, and movement transfer behavior. It allows the scout to inherit motion from platforms and supports different transfer states.
Constructors
PlatformLocomotion()
public PlatformLocomotion()
Fields
DefaultHeightAdjust
Default height adjustment applied when standing on a moving platform.
public static readonly Fixed64 DefaultHeightAdjust
Field Value
- Fixed64
HeightAdjust
The height offset applied when interacting with moving platforms.
public Fixed64 HeightAdjust
Field Value
- Fixed64
MaxHoldPlatformFrames
Maximum number of frames the scout can remain attached to a platform before release.
public const int MaxHoldPlatformFrames = 2
Field Value
Properties
ActivePlatform
The currently active platform the scout is standing on, if any.
[Transient]
public PlatformSnapshot? ActivePlatform { get; set; }
Property Value
FramePlatformVelocity
The last known platform velocity when the scout is airborne.
[Transient]
public Vector3d FramePlatformVelocity { get; set; }
Property Value
- Vector3d
HoldPlatform
The platform snapshot that the scout is currently holding onto, if any.
[Transient]
public PlatformSnapshot? HoldPlatform { get; set; }
Property Value
HoldPlatformFrames
The number of frames the scout has been holding onto a platform.
[Transient]
public int HoldPlatformFrames { get; }
Property Value
InertiaApplied
Indicates whether platform inertia (initial velocity transfer) has been applied.
public bool InertiaApplied { get; }
Property Value
IsActive
Gets a value indicating whether the component is currently active and supports kinematic motion.
public bool IsActive { get; }
Property Value
IsEnabled
Indicates whether this locomotion behavior is enabled. If disabled, its movement effects will not be applied.
public bool IsEnabled { get; set; }
Property Value
IsHoldingPlatform
Gets a value indicating whether the current object is holding a platform that supports kinematic motion.
public bool IsHoldingPlatform { get; }
Property Value
IsLockedToPlatform
Gets a value indicating whether the object is permanently locked to the platform.
public bool IsLockedToPlatform { get; }
Property Value
IsNewPlatform
Indicates whether the scout has just landed on a new platform.
[Transient]
public bool IsNewPlatform { get; set; }
Property Value
MovementTransfer
Defines how movement is transferred from the platform to the scout.
[Transient]
public MotionTransfer MovementTransfer { get; set; }
Property Value
PlatformVelocity
The velocity of the platform.
[Transient]
public Vector3d PlatformVelocity { get; set; }
Property Value
- Vector3d
PreviousPlatform
The previously active platform, used for calculating platform velocity and movement transfer. This is cleared when the scout is not on a platform or when platform locomotion is disabled.
[Transient]
public PlatformSnapshot? PreviousPlatform { get; set; }
Property Value
ScoutLocalPoint
The local position of the scout relative to the platform.
[Transient]
public Vector3d ScoutLocalPoint { get; set; }
Property Value
- Vector3d
ScoutLocalRotation
The local rotation of the scout relative to the platform.
[Transient(typeof(FixedQuaternion), "Identity")]
public FixedQuaternion ScoutLocalRotation { get; set; }
Property Value
- FixedQuaternion
Methods
GetPlatformInfluence(Vector3d, FixedQuaternion, out Vector3d, out FixedQuaternion)
Applies movement adjustments due to platform motion, ensuring the object inherits platform movement correctly.
public void GetPlatformInfluence(Vector3d position, FixedQuaternion rotation, out Vector3d positionDelta, out FixedQuaternion rotationDelta)
Parameters
positionVector3drotationFixedQuaternionpositionDeltaVector3drotationDeltaFixedQuaternion
Remarks
This method updates the object’s position and rotation based on the platform’s transform, preventing unwanted movement shifts when transitioning between platforms.
HandlePlatformChange(GroundCondition?)
Handles changes in the platform state based on the specified ground condition. Updates platform-related movement and state accordingly.
public void HandlePlatformChange(GroundCondition? condition)
Parameters
conditionGroundCondition?The ground condition representing the current platform state. May be null if there is no platform contact.
Remarks
This method should be called whenever the underlying platform or ground condition changes, such as when stepping onto a new platform or leaving one. It resets and updates platform movement and transfer state as needed.
HandlePlatformMovement(Vector3d, FixedQuaternion)
Updates platform movement by synchronizing the object's position and rotation with the platform it is standing on.
public void HandlePlatformMovement(Vector3d position, FixedQuaternion rotation)
Parameters
positionVector3drotationFixedQuaternion
Remarks
This method prevents unwanted movement shifts when transitioning between platforms, ensuring smooth locomotion.
RecordData(IChronicler)
Records the current instance state to the provided chronicler.
public void RecordData(IChronicler chronicler)
Parameters
chroniclerIChroniclerThe active chronicler pass.
SetHoldPlatform(PlatformSnapshot?)
Assigns the scout to a sampled platform state, initiating a hold state.
public void SetHoldPlatform(PlatformSnapshot? platform)
Parameters
platformPlatformSnapshot?The sampled platform snapshot to attach to.
TickHoldOnPlatform()
Updates the platform hold state, releasing the hold if the hold duration expires.
public bool TickHoldOnPlatform()
Returns
- bool
True if the scout should detach from the platform; otherwise, false.
UpdatePlatformVelocity()
Updates the platform velocity based on movement from the last frame.
public void UpdatePlatformVelocity()