How can I change the forward direction of VZBike in unity editor ? - Printable Version

+- (https://forums.vzfit.com)
+-- Forum: VZfit Forum (https://forums.vzfit.com/forumdisplay.php?fid=5)
+--- Forum: General Discussion (https://forums.vzfit.com/forumdisplay.php?fid=6)
+--- Thread: How can I change the forward direction of VZBike in unity editor ? (/showthread.php?tid=380)



How can I change the forward direction of VZBike in unity editor ? - wmlab - 07-16-2020

I already know that "A" and "D" Key can change the bike direction in the unity editor, but I cannot do the same thing with the oculus HMD. In other words, I want to rotate the bike when my head leans left or right. So, where can I get the relative function about this. 
Thank you very much.


RE: How can I change the forward direction of VZBike in unity editor ? - emalafeew - 07-16-2020

Hi, you are talking about using our VZfit SDK for Unity?

If you are playing its test.scene with an Oculus (Rift) headset on PC, then the relative bike direction should change when you lean left and right from your initial calibrated position. That is what A and D mimic when "leaning" without a headset.

It sounds like that is not working for you as it should. First, is your Unity project setup properly to work with a headset? The latest versions of Unity use an "XR plugin management" where you can select Oculus. When you hit Play do you then see the scene correctly in your Oculus? If you are still playing on a keyboard rather than actual bike in Unity, can you calibrate using enter+backspace? And move forward when pressing spacebar?

If all those things are true, then leaning to left or right should change the relative bike direction while you are moving forward. Note leaning specifically means position offset, it does not mean tilting your head. And it specifically only changes the relative bike direction and avatar offset direction, it does not also rotate your VR reference frame and avatar default direction unless you also "look" in the same direction you are leaning. That behavior is how VZfit keeps your eyes and ears in sync in VR and be able to either swerve around things in a straight line or go around curves.

If you want to change or debug that behavior, the logic is in VZPlayer.cs, using lean offsets produced by VZController.cs. Happy to help further when you get there!