feat(runtime): own SetPosition collision reports
This commit is contained in:
parent
ec627c13a2
commit
237d1184d2
19 changed files with 3744 additions and 103 deletions
|
|
@ -164,6 +164,29 @@ public sealed class RuntimeEntityRecord
|
|||
PhysicsBody.State = FinalPhysicsState;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Retail collision reporting clears Missile, AlignPath, and PathClipped
|
||||
/// directly on the live CPhysicsObj. Keep the canonical record and its
|
||||
/// borrowed body in the same mutation edge.
|
||||
/// </summary>
|
||||
internal bool StopMissileAfterCollision(bool requireCurrentMissile)
|
||||
{
|
||||
const PhysicsStateFlags stopped = PhysicsStateFlags.Missile
|
||||
| PhysicsStateFlags.AlignPath
|
||||
| PhysicsStateFlags.PathClipped;
|
||||
if (requireCurrentMissile
|
||||
&& (FinalPhysicsState & PhysicsStateFlags.Missile) == 0)
|
||||
return false;
|
||||
PhysicsStateFlags final = FinalPhysicsState & ~stopped;
|
||||
if (final == FinalPhysicsState)
|
||||
return false;
|
||||
PhysicsStateMutationVersion++;
|
||||
FinalPhysicsState = final;
|
||||
if (PhysicsBody is not null)
|
||||
PhysicsBody.State = FinalPhysicsState;
|
||||
return true;
|
||||
}
|
||||
|
||||
internal void RefreshDerivedState(bool refreshPosition = true)
|
||||
{
|
||||
if (refreshPosition && Snapshot.Position is { } position)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue