2
3
mirror of https://foundry.openuru.org/gitblit/r/CWE-ou-minkata.git synced 2025-07-14 10:37:41 -04: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:
Skoader
2012-12-01 22:03:16 -05:00
committed by Adam Johnson
parent 462d4d6906
commit b5aaecc48d

View File

@ -236,6 +236,25 @@ void plPXPhysicalControllerCore::SetSubworld(plKey world)
IInformDetectors(false);
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
fWorldKey = world;
const plCoordinateInterface* subworldCI = GetSubworldCI();
@ -257,6 +276,7 @@ void plPXPhysicalControllerCore::SetSubworld(plKey world)
// Create new controller
ICreateController(fLocalPosition);
RebuildCache();
}
}