mirror of
https://foundry.openuru.org/gitblit/r/CWE-ou-minkata.git
synced 2025-07-20 04:09:16 +00:00
Fix subworld transition bug
Use the actual global location, not the interpolated location when moving between subworlds. Rebuild the controller cache.
This commit is contained in:
@ -236,6 +236,25 @@ void plPXPhysicalControllerCore::SetSubworld(plKey world)
|
|||||||
IInformDetectors(false);
|
IInformDetectors(false);
|
||||||
IDeleteController();
|
IDeleteController();
|
||||||
|
|
||||||
|
// We need our real global location here, not the interpolated location
|
||||||
|
fLocalRotation.MakeMatrix(&fLastGlobalLoc);
|
||||||
|
fLastGlobalLoc.SetTranslate(&fLocalPosition);
|
||||||
|
if (fWorldKey)
|
||||||
|
{
|
||||||
|
hsMatrix44 prevSubL2W;
|
||||||
|
fPrevSubworldW2L.GetInverse(&prevSubL2W);
|
||||||
|
fLastGlobalLoc = prevSubL2W * fLastGlobalLoc;
|
||||||
|
}
|
||||||
|
// Update our scene object so the change isn't wiped out
|
||||||
|
plSceneObject* so = plSceneObject::ConvertNoRef(fOwner->ObjectIsLoaded());
|
||||||
|
if (so)
|
||||||
|
{
|
||||||
|
hsMatrix44 globalLocInv;
|
||||||
|
fLastGlobalLoc.GetInverse(&globalLocInv);
|
||||||
|
so->SetTransform(fLastGlobalLoc, globalLocInv);
|
||||||
|
so->FlushTransform();
|
||||||
|
}
|
||||||
|
|
||||||
// Update Local Position and rotation
|
// Update Local Position and rotation
|
||||||
fWorldKey = world;
|
fWorldKey = world;
|
||||||
const plCoordinateInterface* subworldCI = GetSubworldCI();
|
const plCoordinateInterface* subworldCI = GetSubworldCI();
|
||||||
@ -257,6 +276,7 @@ void plPXPhysicalControllerCore::SetSubworld(plKey world)
|
|||||||
|
|
||||||
// Create new controller
|
// Create new controller
|
||||||
ICreateController(fLocalPosition);
|
ICreateController(fLocalPosition);
|
||||||
|
RebuildCache();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user