feat(runtime): commit dormant SetPosition activation
This commit is contained in:
parent
99f867f053
commit
5785a07b3e
13 changed files with 4674 additions and 111 deletions
|
|
@ -128,27 +128,11 @@ public static class PhysicsObjUpdate
|
|||
{
|
||||
ArgumentNullException.ThrowIfNull(body);
|
||||
|
||||
if (previousOnWalkable)
|
||||
body.TransientState |= TransientStateFlags.OnWalkable;
|
||||
else
|
||||
body.TransientState &= ~TransientStateFlags.OnWalkable;
|
||||
|
||||
if (inContact)
|
||||
body.TransientState |= TransientStateFlags.Contact;
|
||||
else
|
||||
body.TransientState &= ~TransientStateFlags.Contact;
|
||||
body.calc_acceleration();
|
||||
|
||||
bool finalOnWalkable = inContact && onWalkable;
|
||||
if (finalOnWalkable)
|
||||
body.TransientState |= TransientStateFlags.OnWalkable;
|
||||
else
|
||||
body.TransientState &= ~TransientStateFlags.OnWalkable;
|
||||
|
||||
if (body.ContactPlaneIsWater)
|
||||
body.TransientState |= TransientStateFlags.WaterContact;
|
||||
else
|
||||
body.TransientState &= ~TransientStateFlags.WaterContact;
|
||||
bool finalOnWalkable = CommitSetPositionContactPrefix(
|
||||
body,
|
||||
inContact,
|
||||
onWalkable,
|
||||
previousOnWalkable);
|
||||
|
||||
if (!previousOnWalkable && finalOnWalkable)
|
||||
{
|
||||
|
|
@ -162,10 +146,44 @@ public static class PhysicsObjUpdate
|
|||
if (isCurrent?.Invoke() == false)
|
||||
return false;
|
||||
}
|
||||
body.calc_acceleration();
|
||||
CommitSetPositionPostGround(body);
|
||||
return isCurrent?.Invoke() ?? true;
|
||||
}
|
||||
|
||||
public static bool CommitSetPositionContactPrefix(
|
||||
PhysicsBody body,
|
||||
bool inContact,
|
||||
bool onWalkable,
|
||||
bool previousOnWalkable)
|
||||
{
|
||||
ArgumentNullException.ThrowIfNull(body);
|
||||
if (previousOnWalkable)
|
||||
body.TransientState |= TransientStateFlags.OnWalkable;
|
||||
else
|
||||
body.TransientState &= ~TransientStateFlags.OnWalkable;
|
||||
if (inContact)
|
||||
body.TransientState |= TransientStateFlags.Contact;
|
||||
else
|
||||
body.TransientState &= ~TransientStateFlags.Contact;
|
||||
body.calc_acceleration();
|
||||
bool finalOnWalkable = inContact && onWalkable;
|
||||
if (finalOnWalkable)
|
||||
body.TransientState |= TransientStateFlags.OnWalkable;
|
||||
else
|
||||
body.TransientState &= ~TransientStateFlags.OnWalkable;
|
||||
if (body.ContactPlaneIsWater)
|
||||
body.TransientState |= TransientStateFlags.WaterContact;
|
||||
else
|
||||
body.TransientState &= ~TransientStateFlags.WaterContact;
|
||||
return finalOnWalkable;
|
||||
}
|
||||
|
||||
public static void CommitSetPositionPostGround(PhysicsBody body)
|
||||
{
|
||||
ArgumentNullException.ThrowIfNull(body);
|
||||
body.calc_acceleration();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// retail <c>handle_all_collisions</c> (0x00514780). Reflects or zeros the body's
|
||||
/// <see cref="PhysicsBody.Velocity"/> (retail m_velocityVector) based on
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue