Forum Discussion

🚨 This forum is archived and read-only. To submit a forum post, please visit our new Developer Forum. 🚨
standtall007's avatar
12 years ago

How to make head movement like before??? [Solved]

Hi there, it has been a while since i last posted in here, but that is mainly due to the fact that i have an unsolved question... in SDK 0.4.2 i had fixed my issue by changing two line of code from (vector3.up / .forward) to (transform.up / .forward) in the OVRCamera.cs but that is now impossible because the file from 0.4.2 does not exists anymore, and also i cannot find the same lines of code anymore, these lines to be precise:

Vector3 dir = qp * Vector3.forward;
qp.SetLookRotation(dir, Vector3.up);


those two lines i just need to change to:

Vector3 dir = qp * target.transform.forward;
qp.SetLookRotation(dir, target.transform.up);


where target is :

public GameObject target;


but that is not good enough with the new SDK, so i am asking for assistance to how to make the same functionality in 0.4.3 (or whichever is the newest SDK!) as there was in 0.4.2,

Thanks in advance!
~David

P.S: the two lines can be found (before adding the public variable!) at : 287 & 288!

8 Replies

Replies have been turned off for this discussion
  • Can you let me know specifically what you're trying to accomplish?

    There may be another way to do it.
  • Check in the OVRPlayerController inpector. There is a checkbox called "Hmd rotates Y".

    I think you just need to uncheck the box.
  • thanks Cyber, will try in the morning, am pretty bombed right now :) but will definitely try it out ;)
  • I just tried to find the Hmd Rotates Y but i don't have it on my OVRCameraRig GameObject, or under any of it's child objects!
    What can i the do??? i am using the OVRCameraRig prefab and Not OVRPlayerController prefab!

    Thanks for trying though ;)
    I really appreciate that someone is trying to help me out :)
  • If you are using a custom player controller object, then the issue is likely in your code. You should have full control over how and where your controller moves, and this would be independent of the camera rig.
  • Hi Cyber and everyone else WHO are still struggling with this...

    I have finally found a simple yet doable solution with the folloing code

    public GameObject playerBody;
    public Transform centerEyeAnchor;

    void Update ()
    {
    if(playerBody)
    {
    playerBody.transform.rotation = Quaternion.Euler(0f, centerEyeAnchor.eulerAngles.y, 0f);
    }
    }


    just copy it if you find it useful.
    Though i must pinpoint that this can only be of use (i think!) if you're going to use it with a custom character script!?

    Also i want to thank you Cyber for your help, it was your comments in here that finally led to my solution :P Thank you.

    Oh, btw, this Works at least on 0.4.4 of the unity 4 integration, however i cannot say that it Works the same in 0.4.3!

    Cheers,
    Standtall007. :D
  • Thanks so much for following up with the solution and marking it as solved.