I am attempting to synchronize the view and position of a player to a camera in a different area. To properly sync the direction of the camera with the player, I need to reference Transform.forward to determine the “forward” vector of the player.
The issue is that I can’t get a transform object for the player. You can get the position and rotation separately using VRCPlayerApi.Position and VRCPlayerApi.Rotation, but those both provide a Vector3, not the base transform object.
Boils down to 2 questions:
Is there a way to get the base Transform object for a player?
Is there a way to calculate Transform.Forward only using VRCPlayerApi properties?
Am I using the right position/rotation data, or should I be using VRCPlayerApiTrackingData?
Answer: Yes, using VRCPlayerApi.Position/Rotation provides the position and rotation of the player object itself, not the player’s head (where they would be looking from).
Unity doc on Transform.Forward: Unity - Scripting API: Transform.forward
For reference, I am trying to copy the update method in this video. The code is around the 11:10 mark. Smooth PORTALS in Unity - YouTube