fix(portal): synchronize destination presentation state
This commit is contained in:
parent
4b1bceefbb
commit
e95f55f25b
42 changed files with 2815 additions and 288 deletions
|
|
@ -66,15 +66,56 @@ public class PhysicsBodyCellSyncTests
|
|||
Assert.Equal(0u, body.CellPosition.ObjCellId);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void PositionDelta_InsideEnvCell_AdvancesCanonicalLocalFrame()
|
||||
{
|
||||
var body = new PhysicsBody();
|
||||
body.SnapToCell(
|
||||
0x8C0401ADu,
|
||||
worldPos: new Vector3(12f, -30f, 4f),
|
||||
cellLocal: new Vector3(80f, 40f, 4f));
|
||||
|
||||
body.Position += new Vector3(3f, -2f, 0.5f);
|
||||
|
||||
Assert.Equal(0x8C0401ADu, body.CellPosition.ObjCellId);
|
||||
Assert.Equal(new Vector3(83f, 38f, 4.5f), body.CellPosition.Frame.Origin);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void CommitTransitionPosition_InsideDungeon_AdoptsResolvedEnvCellAndFrame()
|
||||
{
|
||||
var body = new PhysicsBody();
|
||||
body.SnapToCell(
|
||||
0x8C0401ADu,
|
||||
worldPos: new Vector3(12f, -30f, 4f),
|
||||
cellLocal: new Vector3(80f, 40f, 4f));
|
||||
|
||||
body.CommitTransitionPosition(
|
||||
0x8C0401AEu,
|
||||
new Vector3(17f, -27f, 4f));
|
||||
|
||||
Assert.Equal(0x8C0401AEu, body.CellPosition.ObjCellId);
|
||||
Assert.Equal(new Vector3(85f, 43f, 4f), body.CellPosition.Frame.Origin);
|
||||
Assert.Equal(new Vector3(17f, -27f, 4f), body.Position);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void CommitTransitionPosition_WithoutSeed_DoesNotInventCanonicalCell()
|
||||
{
|
||||
var body = new PhysicsBody();
|
||||
|
||||
body.CommitTransitionPosition(0x8C0401ADu, new Vector3(1f, 2f, 3f));
|
||||
|
||||
Assert.Equal(0u, body.CellPosition.ObjCellId);
|
||||
Assert.Equal(new Vector3(1f, 2f, 3f), body.Position);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ContinuousTracking_LongWalkAcrossCellsAndBlock_NeverGoesStale()
|
||||
{
|
||||
// Refutes the "CellPosition goes stale" concern (incl. the indoor-transit case):
|
||||
// because the Position setter re-derives the cell via AdjustToOutside on EVERY
|
||||
// write, CellPosition continuously tracks the outdoor cell under the body's WORLD
|
||||
// position. The body is always world-space, so the world delta is frame-invariant —
|
||||
// there is no separate "interior" frame to desync. On any exit it is the correct
|
||||
// cell, never stale.
|
||||
// Refutes outdoor CellPosition drift: the Position setter re-derives the
|
||||
// cell via AdjustToOutside on every write, so the carried (cell, local)
|
||||
// pair continuously tracks the body across cells and landblocks.
|
||||
var body = new PhysicsBody();
|
||||
body.SnapToCell(0xC95B0001u, new Vector3(1000f, 2000f, 12f), new Vector3(10f, 10f, 12f));
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue