Using VRCPlayerApi.TeleportTo with AlignRoomWithSpawnPoint results in broken teleportation behavior. This has been broken since ClientSim's initial release.
Looking at the code, the handling of "from playspace" is basically the same code from CyanEmu, not properly considering how the PlayerController's hierarchy has changed.
|
if (fromPlaySpace) |
|
{ |
|
var playspaceData = _trackingProvider.GetTrackingData(VRCPlayerApi.TrackingDataType.Origin); |
|
floorRotation = Quaternion.Inverse(playspaceData.rotation) * floorRotation; |
|
position = position + floorRotation * -playspaceData.position; |
|
} |
https://github.com/CyanLaser/CyanEmu/blob/daf42066ab61e73c187cc6f16352304735c28343/CyanEmu/Scripts/CyanEmuPlayerController.cs#L519-L523
Here is a potential fix:
if (fromPlaySpace)
{
var playspaceData = _trackingProvider.GetTrackingData(VRCPlayerApi.TrackingDataType.Origin);
Vector3 playspacePos = playspaceData.position - transform.position;
Quaternion playspaceRot = playspaceData.rotation * Quaternion.Inverse(transform.rotation);
floorRotation = Quaternion.Inverse(playspaceRot) * floorRotation;
position = position + floorRotation * -playspacePos;
}
I'm disappointed that no one has reported or fixed this bug in the past 3 years, even though I know many creators have referenced it...
Using VRCPlayerApi.TeleportTo with AlignRoomWithSpawnPoint results in broken teleportation behavior. This has been broken since ClientSim's initial release.
Looking at the code, the handling of "from playspace" is basically the same code from CyanEmu, not properly considering how the PlayerController's hierarchy has changed.
ClientSim/Packages/com.vrchat.ClientSim/Runtime/Player/ClientSimPlayerController.cs
Lines 230 to 235 in 43e43b0
https://github.com/CyanLaser/CyanEmu/blob/daf42066ab61e73c187cc6f16352304735c28343/CyanEmu/Scripts/CyanEmuPlayerController.cs#L519-L523
Here is a potential fix:
I'm disappointed that no one has reported or fixed this bug in the past 3 years, even though I know many creators have referenced it...