| | | 1 | | using Chronicler; |
| | | 2 | | using FixedMathSharp; |
| | | 3 | | using System; |
| | | 4 | | using System.Runtime.CompilerServices; |
| | | 5 | | using Trailblazer.Support; |
| | | 6 | | |
| | | 7 | | namespace Trailblazer.Navigation.Motor; |
| | | 8 | | |
| | | 9 | | /// <summary> |
| | | 10 | | /// Handles movement adjustments when the scout is standing on a moving platform or surface. |
| | | 11 | | /// </summary> |
| | | 12 | | /// <remarks> |
| | | 13 | | /// This locomotion system tracks platform velocity, rotation, and movement transfer behavior. |
| | | 14 | | /// It allows the scout to inherit motion from platforms and supports different transfer states. |
| | | 15 | | /// </remarks> |
| | | 16 | | public class PlatformLocomotion : ILocomotion |
| | | 17 | | { |
| | | 18 | | private TrailblazerWorldContext? _context; |
| | | 19 | | |
| | | 20 | | #region Constants |
| | | 21 | | |
| | | 22 | | /// <summary> |
| | | 23 | | /// Default height adjustment applied when standing on a moving platform. |
| | | 24 | | /// </summary> |
| | 1 | 25 | | public static readonly Fixed64 DefaultHeightAdjust = Fixed64.FromRaw(0x80000000L); // 0.5f; |
| | | 26 | | |
| | | 27 | | /// <summary> |
| | | 28 | | /// Maximum number of frames the scout can remain attached to a platform before release. |
| | | 29 | | /// </summary> |
| | | 30 | | public const int MaxHoldPlatformFrames = 2; |
| | | 31 | | |
| | | 32 | | #endregion |
| | | 33 | | |
| | | 34 | | #region Configuration State |
| | | 35 | | |
| | | 36 | | /// <summary> |
| | | 37 | | /// Determines whether platform locomotion is enabled. |
| | | 38 | | /// </summary> |
| | 831 | 39 | | private bool _isEnabled = true; |
| | | 40 | | |
| | | 41 | | /// <summary> |
| | | 42 | | /// The height offset applied when interacting with moving platforms. |
| | | 43 | | /// </summary> |
| | 831 | 44 | | public Fixed64 HeightAdjust = DefaultHeightAdjust; |
| | | 45 | | |
| | | 46 | | #endregion |
| | | 47 | | |
| | | 48 | | #region Transient State |
| | | 49 | | |
| | | 50 | | /// <inheritdoc cref="ILocomotion.IsEnabled"/> |
| | | 51 | | public bool IsEnabled |
| | | 52 | | { |
| | 16198 | 53 | | get => _isEnabled; |
| | | 54 | | set |
| | | 55 | | { |
| | 5 | 56 | | _isEnabled = value; |
| | 5 | 57 | | if (!_isEnabled) |
| | | 58 | | { |
| | 4 | 59 | | _preservePreviousTransformForAttachment = false; |
| | 4 | 60 | | this.ClearTransientState(); |
| | | 61 | | } |
| | 5 | 62 | | } |
| | | 63 | | } |
| | | 64 | | |
| | | 65 | | /// <summary> |
| | | 66 | | /// Indicates whether the scout has just landed on a new platform. |
| | | 67 | | /// </summary> |
| | | 68 | | [Transient] |
| | | 69 | | public bool IsNewPlatform { get; set; } |
| | | 70 | | |
| | | 71 | | /// <summary> |
| | | 72 | | /// The currently active platform the scout is standing on, if any. |
| | | 73 | | /// </summary> |
| | | 74 | | [Transient] |
| | | 75 | | public PlatformSnapshot? ActivePlatform { get; set; } |
| | | 76 | | |
| | | 77 | | /// <summary> |
| | | 78 | | /// The previously active platform, used for calculating platform velocity and movement transfer. |
| | | 79 | | /// This is cleared when the scout is not on a platform or when platform locomotion is disabled. |
| | | 80 | | /// |
| | | 81 | | /// </summary> |
| | | 82 | | [Transient] |
| | | 83 | | public PlatformSnapshot? PreviousPlatform { get; set; } |
| | | 84 | | |
| | | 85 | | /// <summary> |
| | | 86 | | /// A flag to preserve the previous platform's transform for attachment calculations, |
| | | 87 | | /// used when refreshing the same platform with a new transform. |
| | | 88 | | /// </summary> |
| | | 89 | | private bool _preservePreviousTransformForAttachment; |
| | | 90 | | |
| | | 91 | | /// <summary> |
| | | 92 | | /// The platform snapshot that the scout is currently holding onto, if any. |
| | | 93 | | /// </summary> |
| | | 94 | | [Transient] |
| | | 95 | | public PlatformSnapshot? HoldPlatform { get; set; } |
| | | 96 | | |
| | | 97 | | /// <summary> |
| | | 98 | | /// Defines how movement is transferred from the platform to the scout. |
| | | 99 | | /// </summary> |
| | | 100 | | [Transient] |
| | | 101 | | public MotionTransfer MovementTransfer { get; set; } |
| | | 102 | | |
| | | 103 | | /// <summary> |
| | | 104 | | /// The local position of the scout relative to the platform. |
| | | 105 | | /// </summary> |
| | | 106 | | [Transient] |
| | | 107 | | public Vector3d ScoutLocalPoint { get; set; } |
| | | 108 | | |
| | | 109 | | /// <summary> |
| | | 110 | | /// The local rotation of the scout relative to the platform. |
| | | 111 | | /// </summary> |
| | | 112 | | [Transient(typeof(FixedQuaternion), nameof(FixedQuaternion.Identity))] |
| | | 113 | | public FixedQuaternion ScoutLocalRotation { get; set; } = FixedQuaternion.Identity; |
| | | 114 | | |
| | | 115 | | /// <summary> |
| | | 116 | | /// The velocity of the platform. |
| | | 117 | | /// </summary> |
| | | 118 | | [Transient] |
| | | 119 | | public Vector3d PlatformVelocity { get; set; } |
| | | 120 | | |
| | | 121 | | /// <summary> |
| | | 122 | | /// The last known platform velocity when the scout is airborne. |
| | | 123 | | /// </summary> |
| | | 124 | | [Transient] |
| | | 125 | | public Vector3d FramePlatformVelocity { get; set; } |
| | | 126 | | |
| | | 127 | | private TrailblazerWorldContext RequireContext() => |
| | 311 | 128 | | _context ?? throw new InvalidOperationException("PlatformLocomotion requires an explicit TrailblazerWorldContext |
| | | 129 | | |
| | 311 | 130 | | private Fixed64 InvDeltaTime => RequireContext().InvDeltaTime; |
| | | 131 | | |
| | | 132 | | /// <summary> |
| | | 133 | | /// The number of frames the scout has been holding onto a platform. |
| | | 134 | | /// </summary> |
| | | 135 | | [Transient] |
| | | 136 | | public int HoldPlatformFrames { get; private set; } |
| | | 137 | | |
| | | 138 | | /// <summary> |
| | | 139 | | /// Gets a value indicating whether the component is currently active and supports kinematic motion. |
| | | 140 | | /// </summary> |
| | 4138 | 141 | | public bool IsActive => IsEnabled && ActivePlatform?.SupportsKinematicMotion == true; |
| | | 142 | | |
| | | 143 | | /// <summary> |
| | | 144 | | /// Gets a value indicating whether the object is permanently locked to the platform. |
| | | 145 | | /// </summary> |
| | 443 | 146 | | public bool IsLockedToPlatform => MovementTransfer == MotionTransfer.PermaLocked; |
| | | 147 | | |
| | | 148 | | /// <summary> |
| | | 149 | | /// Gets a value indicating whether the current object is holding a platform that supports kinematic motion. |
| | | 150 | | /// </summary> |
| | 1884 | 151 | | public bool IsHoldingPlatform => IsEnabled && HoldPlatform?.SupportsKinematicMotion == true; |
| | | 152 | | |
| | | 153 | | /// <summary> |
| | | 154 | | /// Indicates whether platform inertia (initial velocity transfer) has been applied. |
| | | 155 | | /// </summary> |
| | 1873 | 156 | | public bool InteriaApplied => IsEnabled |
| | 1873 | 157 | | && (MovementTransfer == MotionTransfer.InitTransfer || MovementTransfer == MotionTransfer.PermaTransfer); |
| | | 158 | | |
| | | 159 | | #endregion |
| | | 160 | | |
| | | 161 | | #region Methods |
| | | 162 | | |
| | | 163 | | /// <summary> |
| | | 164 | | /// Updates the platform velocity based on movement from the last frame. |
| | | 165 | | /// </summary> |
| | | 166 | | public void UpdatePlatformVelocity() |
| | | 167 | | { |
| | 2092 | 168 | | if (!IsEnabled) return; |
| | | 169 | | |
| | 2090 | 170 | | if (ActivePlatform?.SupportsKinematicMotion != true) |
| | | 171 | | { |
| | 1705 | 172 | | PlatformVelocity = Vector3d.Zero; |
| | 1705 | 173 | | _preservePreviousTransformForAttachment = false; |
| | 1705 | 174 | | return; |
| | | 175 | | } |
| | | 176 | | |
| | 385 | 177 | | if (!IsNewPlatform) |
| | | 178 | | { |
| | 311 | 179 | | Vector3d currentPoint = ActivePlatform.Value.Transform.TransformPoint(ScoutLocalPoint); |
| | 311 | 180 | | Vector3d previousPoint = PreviousPlatform?.Transform.TransformPoint(ScoutLocalPoint) ?? Vector3d.Zero; |
| | | 181 | | |
| | | 182 | | // Store platform velocity to use as a canceling force |
| | 311 | 183 | | PlatformVelocity = (currentPoint - previousPoint) * InvDeltaTime; |
| | | 184 | | } |
| | | 185 | | |
| | 385 | 186 | | PreviousPlatform = ActivePlatform; |
| | 385 | 187 | | IsNewPlatform = false; |
| | 385 | 188 | | _preservePreviousTransformForAttachment = false; |
| | 385 | 189 | | } |
| | | 190 | | |
| | | 191 | | internal void BindContext(TrailblazerWorldContext context) |
| | | 192 | | { |
| | 895 | 193 | | Trailblazer.Pathing.PathRequestContextResolver.ThrowIfUnusable(context); |
| | 895 | 194 | | _context = context; |
| | 895 | 195 | | } |
| | | 196 | | |
| | | 197 | | /// <summary> |
| | | 198 | | /// Applies movement adjustments due to platform motion, ensuring the object inherits platform movement correctly. |
| | | 199 | | /// </summary> |
| | | 200 | | /// <remarks> |
| | | 201 | | /// This method updates the object’s position and rotation based on the platform’s transform, |
| | | 202 | | /// preventing unwanted movement shifts when transitioning between platforms. |
| | | 203 | | /// </remarks> |
| | | 204 | | public void GetPlatformInfluence( |
| | | 205 | | Vector3d position, |
| | | 206 | | FixedQuaternion rotation, |
| | | 207 | | out Vector3d positionDelta, |
| | | 208 | | out FixedQuaternion rotationDelta) |
| | | 209 | | { |
| | | 210 | | // Apply platform rotation first THEN apply platform movement |
| | 147 | 211 | | FixedQuaternion targetRotation = ActivePlatform?.Transform.Rotation * ScoutLocalRotation ?? FixedQuaternion.Iden |
| | 147 | 212 | | if (targetRotation != FixedQuaternion.Identity) |
| | | 213 | | { |
| | 50 | 214 | | FixedQuaternion rotDelta = targetRotation * rotation.Inverse(); |
| | 50 | 215 | | rotationDelta = rotDelta; |
| | | 216 | | } |
| | | 217 | | else |
| | 97 | 218 | | rotationDelta = FixedQuaternion.Identity; |
| | | 219 | | |
| | 147 | 220 | | Vector3d newGlobalPoint = ActivePlatform?.Transform.TransformPoint(ScoutLocalPoint) ?? Vector3d.Zero; |
| | 147 | 221 | | position.y += HeightAdjust; |
| | 147 | 222 | | positionDelta = newGlobalPoint - position; |
| | 147 | 223 | | } |
| | | 224 | | |
| | | 225 | | /// <summary> |
| | | 226 | | /// Assigns the scout to a sampled platform state, initiating a hold state. |
| | | 227 | | /// </summary> |
| | | 228 | | /// <param name="platform">The sampled platform snapshot to attach to.</param> |
| | | 229 | | public void SetHoldPlatform(PlatformSnapshot? platform) |
| | | 230 | | { |
| | 9 | 231 | | HoldPlatform = NormalizeKinematicPlatform(platform); |
| | 9 | 232 | | HoldPlatformFrames = 0; |
| | 9 | 233 | | } |
| | | 234 | | |
| | | 235 | | /// <summary> |
| | | 236 | | /// Updates the platform hold state, releasing the hold if the hold duration expires. |
| | | 237 | | /// </summary> |
| | | 238 | | /// <returns>True if the scout should detach from the platform; otherwise, false.</returns> |
| | | 239 | | public bool TickHoldOnPlatform() |
| | | 240 | | { |
| | 11 | 241 | | if (!IsHoldingPlatform) |
| | 1 | 242 | | return false; |
| | | 243 | | |
| | 10 | 244 | | HoldPlatformFrames++; |
| | 10 | 245 | | if (HoldPlatformFrames >= MaxHoldPlatformFrames) |
| | | 246 | | { |
| | 3 | 247 | | HoldPlatformFrames = 0; |
| | 3 | 248 | | if (HoldPlatform != ActivePlatform) |
| | 2 | 249 | | return true; |
| | | 250 | | } |
| | | 251 | | |
| | 8 | 252 | | return false; |
| | | 253 | | } |
| | | 254 | | |
| | | 255 | | /// <summary> |
| | | 256 | | /// Handles changes in the platform state based on the specified ground condition. Updates platform-related movement |
| | | 257 | | /// </summary> |
| | | 258 | | /// <remarks> |
| | | 259 | | /// This method should be called whenever the underlying platform or ground condition changes, |
| | | 260 | | /// such as when stepping onto a new platform or leaving one. |
| | | 261 | | /// It resets and updates platform movement and transfer state as needed. |
| | | 262 | | /// </remarks> |
| | | 263 | | /// <param name="condition">The ground condition representing the current platform state. May be null if there is no |
| | | 264 | | public void HandlePlatformChange(GroundCondition? condition) |
| | | 265 | | { |
| | | 266 | | // If we hit a new platform, reset platform state |
| | 2305 | 267 | | if (!IsEnabled) |
| | 1 | 268 | | return; |
| | | 269 | | |
| | | 270 | | // Clear it to avoid double-applying next frame |
| | 2304 | 271 | | FramePlatformVelocity = Vector3d.Zero; |
| | 2304 | 272 | | PlatformSnapshot? refreshedPlatform = NormalizeKinematicPlatform(condition?.Platform); |
| | 2304 | 273 | | MovementTransfer = ResolveMovementTransfer(refreshedPlatform, condition); |
| | 2304 | 274 | | ClearHoldPlatformIfInactive(refreshedPlatform); |
| | | 275 | | |
| | 2304 | 276 | | if (TryRefreshExistingPlatform(refreshedPlatform)) |
| | 2168 | 277 | | return; |
| | | 278 | | |
| | 136 | 279 | | SwapActivePlatform(refreshedPlatform); |
| | 136 | 280 | | } |
| | | 281 | | |
| | | 282 | | /// <summary> |
| | | 283 | | /// Determines if the object has transitioned onto a different platform. |
| | | 284 | | /// </summary> |
| | | 285 | | /// <param name="newPlatform"></param> |
| | | 286 | | /// <returns>True if the object is on a new platform; otherwise, false.</returns> |
| | 2304 | 287 | | private bool DidPlatformChange(PlatformSnapshot? newPlatform) => ActivePlatform != newPlatform; |
| | | 288 | | |
| | | 289 | | private static PlatformSnapshot? NormalizeKinematicPlatform(PlatformSnapshot? platform) |
| | | 290 | | { |
| | 2472 | 291 | | return platform?.SupportsKinematicMotion == true |
| | 2472 | 292 | | ? platform |
| | 2472 | 293 | | : null; |
| | | 294 | | } |
| | | 295 | | |
| | | 296 | | [MethodImpl(MethodImplOptions.AggressiveInlining)] |
| | | 297 | | private static MotionTransfer ResolveMovementTransfer(PlatformSnapshot? refreshedPlatform, GroundCondition? conditio |
| | | 298 | | { |
| | 2304 | 299 | | return refreshedPlatform?.SupportsKinematicMotion == true |
| | 2304 | 300 | | // refreshedPlatform comes from condition.Platform, so a kinematic snapshot implies condition exists. |
| | 2304 | 301 | | ? condition!.Value.MotionTransferState |
| | 2304 | 302 | | : MotionTransfer.None; |
| | | 303 | | } |
| | | 304 | | |
| | | 305 | | [MethodImpl(MethodImplOptions.AggressiveInlining)] |
| | | 306 | | private void ClearHoldPlatformIfInactive(PlatformSnapshot? refreshedPlatform) |
| | | 307 | | { |
| | 2304 | 308 | | if (refreshedPlatform?.SupportsKinematicMotion == true) |
| | 503 | 309 | | return; |
| | | 310 | | |
| | 1801 | 311 | | HoldPlatform = null; |
| | 1801 | 312 | | HoldPlatformFrames = 0; |
| | 1801 | 313 | | } |
| | | 314 | | |
| | | 315 | | private bool TryRefreshExistingPlatform(PlatformSnapshot? refreshedPlatform) |
| | | 316 | | { |
| | 2304 | 317 | | if (DidPlatformChange(refreshedPlatform)) |
| | 136 | 318 | | return false; |
| | | 319 | | |
| | 2168 | 320 | | bool hasTransformRefresh = ActivePlatform?.SupportsKinematicMotion == true |
| | 2168 | 321 | | && refreshedPlatform?.SupportsKinematicMotion == true |
| | 2168 | 322 | | && !ActivePlatform.Value.Transform.Equals(refreshedPlatform.Value.Transform); |
| | | 323 | | |
| | 2168 | 324 | | if (hasTransformRefresh) |
| | 9 | 325 | | PreviousPlatform = ActivePlatform; |
| | | 326 | | |
| | | 327 | | // Same platform id, newer transform: refresh the snapshot without marking a platform swap. |
| | 2168 | 328 | | ActivePlatform = refreshedPlatform; |
| | 2168 | 329 | | _preservePreviousTransformForAttachment = hasTransformRefresh; |
| | 2168 | 330 | | return true; |
| | | 331 | | } |
| | | 332 | | |
| | | 333 | | private void SwapActivePlatform(PlatformSnapshot? refreshedPlatform) |
| | | 334 | | { |
| | 136 | 335 | | PreviousPlatform = ActivePlatform?.SupportsKinematicMotion != true |
| | 136 | 336 | | ? refreshedPlatform |
| | 136 | 337 | | : ActivePlatform; |
| | 136 | 338 | | ActivePlatform = refreshedPlatform; |
| | | 339 | | |
| | 136 | 340 | | IsNewPlatform = refreshedPlatform?.SupportsKinematicMotion == true; |
| | 136 | 341 | | _preservePreviousTransformForAttachment = false; |
| | 136 | 342 | | } |
| | | 343 | | |
| | | 344 | | /// <summary> |
| | | 345 | | /// Updates platform movement by synchronizing the object's position and rotation with the platform it is standing o |
| | | 346 | | /// </summary> |
| | | 347 | | /// <remarks> |
| | | 348 | | /// This method prevents unwanted movement shifts when transitioning between platforms, ensuring smooth locomotion. |
| | | 349 | | /// </remarks> |
| | | 350 | | public void HandlePlatformMovement(Vector3d position, FixedQuaternion rotation) |
| | | 351 | | { |
| | 143 | 352 | | position.y += HeightAdjust; |
| | 143 | 353 | | Fixed4x4 attachmentTransform = GetAttachmentTransform(); |
| | 143 | 354 | | ScoutLocalPoint = Fixed4x4.InverseTransformPoint( |
| | 143 | 355 | | attachmentTransform, |
| | 143 | 356 | | position); |
| | | 357 | | |
| | 143 | 358 | | ScoutLocalRotation = attachmentTransform.Rotation.Inverse() * rotation; |
| | 143 | 359 | | } |
| | | 360 | | |
| | | 361 | | private Fixed4x4 GetAttachmentTransform() |
| | | 362 | | { |
| | 143 | 363 | | if (_preservePreviousTransformForAttachment && PreviousPlatform?.SupportsKinematicMotion == true) |
| | 8 | 364 | | return PreviousPlatform.Value.Transform; |
| | | 365 | | |
| | 135 | 366 | | return ActivePlatform?.Transform ?? Fixed4x4.Identity; |
| | | 367 | | } |
| | | 368 | | |
| | | 369 | | #endregion |
| | | 370 | | |
| | | 371 | | /// <inheritdoc /> |
| | | 372 | | public void RecordData(IChronicler chronicler) |
| | | 373 | | { |
| | 106 | 374 | | RecordValues.Look(chronicler, ref _isEnabled, "IsEnabled", true); |
| | 106 | 375 | | RecordValues.Look(chronicler, ref HeightAdjust, "HeightAdjust", DefaultHeightAdjust); |
| | | 376 | | |
| | 106 | 377 | | bool isNewPlatform = IsNewPlatform; |
| | 106 | 378 | | PlatformSnapshot? activePlatform = ActivePlatform; |
| | 106 | 379 | | PlatformSnapshot? previousPlatform = PreviousPlatform; |
| | 106 | 380 | | PlatformSnapshot? holdPlatform = HoldPlatform; |
| | 106 | 381 | | MotionTransfer movementTransfer = MovementTransfer; |
| | 106 | 382 | | Vector3d scoutLocalPoint = ScoutLocalPoint; |
| | 106 | 383 | | FixedQuaternion scoutLocalRotation = ScoutLocalRotation; |
| | 106 | 384 | | Vector3d platformVelocity = PlatformVelocity; |
| | 106 | 385 | | Vector3d framePlatformVelocity = FramePlatformVelocity; |
| | 106 | 386 | | int holdPlatformFrames = HoldPlatformFrames; |
| | | 387 | | |
| | 106 | 388 | | RecordValues.Look(chronicler, ref isNewPlatform, "IsNewPlatform", false); |
| | 106 | 389 | | RecordValues.Look(chronicler, ref activePlatform, "ActivePlatform", null); |
| | 106 | 390 | | RecordValues.Look(chronicler, ref previousPlatform, "PreviousPlatform", null); |
| | 106 | 391 | | RecordValues.Look(chronicler, ref holdPlatform, "HoldPlatform", null); |
| | 106 | 392 | | RecordValues.Look(chronicler, ref movementTransfer, "MovementTransfer", MotionTransfer.None); |
| | 106 | 393 | | RecordValues.Look(chronicler, ref scoutLocalPoint, "ScoutLocalPoint", Vector3d.Zero); |
| | 106 | 394 | | RecordValues.Look(chronicler, ref scoutLocalRotation, "ScoutLocalRotation", FixedQuaternion.Identity); |
| | 106 | 395 | | RecordValues.Look(chronicler, ref platformVelocity, "PlatformVelocity", Vector3d.Zero); |
| | 106 | 396 | | RecordValues.Look(chronicler, ref framePlatformVelocity, "FramePlatformVelocity", Vector3d.Zero); |
| | 106 | 397 | | RecordValues.Look(chronicler, ref holdPlatformFrames, "HoldPlatformFrames", 0); |
| | | 398 | | |
| | 106 | 399 | | if (chronicler.Mode == SerializationMode.Loading) |
| | | 400 | | { |
| | 53 | 401 | | ActivePlatform = NormalizeKinematicPlatform(activePlatform); |
| | 53 | 402 | | PreviousPlatform = NormalizeKinematicPlatform(previousPlatform); |
| | 53 | 403 | | HoldPlatform = NormalizeKinematicPlatform(holdPlatform); |
| | 53 | 404 | | IsNewPlatform = ActivePlatform?.SupportsKinematicMotion == true && isNewPlatform; |
| | 53 | 405 | | MovementTransfer = ActivePlatform?.SupportsKinematicMotion == true |
| | 53 | 406 | | ? movementTransfer |
| | 53 | 407 | | : MotionTransfer.None; |
| | 53 | 408 | | ScoutLocalPoint = scoutLocalPoint; |
| | 53 | 409 | | ScoutLocalRotation = scoutLocalRotation; |
| | 53 | 410 | | PlatformVelocity = ActivePlatform?.SupportsKinematicMotion == true |
| | 53 | 411 | | ? platformVelocity |
| | 53 | 412 | | : Vector3d.Zero; |
| | 53 | 413 | | FramePlatformVelocity = ActivePlatform?.SupportsKinematicMotion == true |
| | 53 | 414 | | ? framePlatformVelocity |
| | 53 | 415 | | : Vector3d.Zero; |
| | 53 | 416 | | HoldPlatformFrames = HoldPlatform?.SupportsKinematicMotion == true |
| | 53 | 417 | | ? holdPlatformFrames |
| | 53 | 418 | | : 0; |
| | 53 | 419 | | _preservePreviousTransformForAttachment = false; |
| | | 420 | | |
| | 53 | 421 | | if (!_isEnabled) |
| | 2 | 422 | | this.ClearTransientState(); |
| | | 423 | | } |
| | 106 | 424 | | } |
| | | 425 | | } |