[1333] Unexpected behavior of PlayerApi.GetRotation
complete
Shiro K
I use a system where players are permanent attached to stations (own station is set to mobile, other ones to immobilized). The position and rotation of stations are synced (PlayerApi.GetPosition, PlayerApi.GetRotation). I use this system to be able to walk around planets. This worked fine before ik-2.
In this scene, my feet points to a mirror and I turn my head to the tiger. When I turn my head from tigers perspective, my feet slaps to its body and my head points in another direction. I seems like the rotation will be applied twice (root + head).
It is the same behavior, when I turn with my controller. When I move slighly forward or backward, I will suddenly rotate back in the right position.
Is this a bug or a new behavior/breaking change?
How can I sync stations with ik-2, so that there are no rotation offsets/jumps?
My world is not public yet. But there is a world, which uses the same principle and where the behavior can be reproduced: https://vrchat.com/home/launch?worldId=wrld_bff9dcbd-d43a-4815-8dea-ef0d9455feba
Log In
Kung
complete
The changes to address this are in the VRChat 2023.3.2 release. Make sure to use the newest SDK as well to get access to the AvatarRoot tracking data type. You can read more about it here: https://creators.vrchat.com/worlds/udon/players/player-positions#gettrackingdata
iffn
Kung: The latest world SDK I can get using the Creator Companion is 3.2.3, and that one doesn't seem to have the AvatarRoot TrackingDataType
Edit: Fixed by enabling preview packages and using 3.3.0-beta.1
Shiro K
Kung: Yes - with AvatarRoot it works the same way as before for my use case. Thanks for the update!
Phasedragon
available in future release
This is now (partly) fixed in the open beta by introducing a new TrackingDataType, AvatarRoot. GetTrackingData with this type will provide the rotation that you are looking for in this particular use case. You'll have to wait for the SDK to be released before using this feature, though.
Kung
in progress
Kung
Thanks for bringing up this use case! In general the behavior of the data returned by GetRotation won't change (will continue to provide an orientation with a forward direction rotated by the head), but because the behavior of the avatar root transform itself is changed by the FBT jitter fix (no longer constantly rotating the root transform with the head) when you need to interact directly with the avatar root transform such as in the case of stations it presents a problem for FBT users after the jitter fix.
To address this particular use case we're adding a new TrackingDataType to the GetTrackingData function: "AvatarRoot" which will return the rotation (and position) that previously would have been returned by GetRotation, but will reflect the actual avatar root transform only, rather than including additional handling for returning the head-forward orientation of an FBT user with an unrotated avatar root transform.
I believe this will require an SDK update for it to become available to you, so it's not currently yet available in the ik-beta.
Shiro K
Kung: Thank you for your detailed explanation! Then it's also clear, why it works while FBT is disabled. I will test it as soon the new SDK is available.
Because of the rotation offset, I didn't notice if there is also a position offset. As I understand your answer there will be no difference between GetPosition and the new GetTrackingData(TrackingDataType.AvatarRoot).position. So it doesn't matter which method I use for position, right?
Kung
Shiro K: That's right, the position information should be the same. So it's probably most efficient to just use the position information already available from GetTrackingData if you're already calling that function.
Shiro K
Kung: Perfect - thanks to confirm that :-)