06-04-2021 10:42 AM
08-10-2021 02:32 AM
@Tembac Did you solve it in a good way? I'm trying to achieve this with Open XR and getting the height by just getting the main cameras height from the "floor" (y: 0). But when starting the app, it will return 0. So I guess it takes a couple of frames before the camera is set to the correct height. So would need an event to lissen to or something to get the current height instead.
Example implementation:
https://www.youtube.com/watch?v=WAVa_9ilIEQ&t=201s
08-10-2021 02:49 AM - edited 08-11-2021 08:52 AM
EDIT: Sorry, this doesnt work. Will adjust your scale for each frame 😂.
After digging though the TrackedPoseDriver class, I saw they used the InputSystem.onAfterUpdate event. So run the Resize function in the example above (getting the localPosition.y from the camera, and divide why a default height to get a scale value to apply to the CameraOffset or XR rig GameObject) when this event was triggered instead, and it seems to work. Will need some more testing to confirm everything works fine.
private void OnEnable()
{
InputSystem.onAfterUpdate += InputSystemOnonAfterUpdate;
}
private void OnDisable()
{
InputSystem.onAfterUpdate -= InputSystemOnonAfterUpdate;
}
private void InputSystemOnonAfterUpdate()
{
Resize();
}