Forum Discussion

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

Getting the camera height adjustment keys back on 0.4.3.1 ?

So the 0.4.2 Oculus package had this "Use player eye height" checkbox that allowed you to change the players height with the 5 and 6 keys if you disabled it, but after 0.4.3 it's gone. I googled around and found this guys suggestion, however I just can't it to work as I'm clueless with Unity scripting and don't know what I'm doing wrong.

Any help or a step by step guide would be much appreciated, having adjustable camera height is pivotal with my project and I don't want to roll back to an older version.

7 Replies

Replies have been turned off for this discussion
  • Try adding this code to the end of UpdateMovement in OVRPlayerController.cs:

    Vector3 adj = new Vector3(0.0f, 0.1f, 0.0f);

    if (Input.GetKeyDown (KeyCode.Alpha5))
    CameraController.transform.localPosition -= adj;
    if (Input.GetKeyDown (KeyCode.Alpha6))
    CameraController.transform.localPosition += adj;


    Make sure to uncheck "Use Profile Height".
  • mtrx's avatar
    mtrx
    Honored Guest
    Yes! It worked! Thanks. :)

    Now my U-boat demo can finally progress. :D
  • "cybereality" wrote:
    Try adding this code to the end of UpdateMovement in OVRPlayerController.cs:

    Vector3 adj = new Vector3(0.0f, 0.1f, 0.0f);

    if (Input.GetKeyDown (KeyCode.Alpha5))
    CameraController.transform.localPosition -= adj;
    if (Input.GetKeyDown (KeyCode.Alpha6))
    CameraController.transform.localPosition += adj;


    Make sure to uncheck "Use Profile Height".


    Can you be more specific as to where to place this? I'm not a programmer and I did a 'movement' search in the code and couldn't find a definitive 'update movement' section. I think I may have found it, but then I'm unsure on how to 'rebuild' the code (without errors)... :D

    Thanks!
  • "cybereality" wrote:
    You can add that code around line 300 (in the end of the UpdateMovement() function).

    However, if that is confusing to you, you're gonna have big trouble trying to program a game.

    Maybe try buying some books on Unity development. This one is good if you don't know about programming:

    Learning C# by Developing Games with Unity 3D Beginner's Guide
    http://www.amazon.com/Learning-Developing-Games-Unity-Beginners-ebook/dp/B00FFUL9LY


    Not necessarily confusing, I understand what needs done, just no idea on how to actually do it aside from copy/paste... haha. My goal as of know is just simple architectural walkthroughs to flush out potential design flaws. No foreseeable games in my future.

    EDIT** I got it working, seems that I didn't need to build the code? I think I just saved it and it worked. The numberpad didn't work though. I had to use the numbers along the top of the keyboard.
    Here is the edit @ line 300 for the other clueless like me :D
    			* dirXform.TransformDirection(Vector3.right * moveInfluence) * BackAndSideDampen;

    float rightAxisX = OVRGamepadController.GPC_GetAxis(OVRGamepadController.Axis.RightXAxis);

    euler.y += rightAxisX * rotateInfluence;

    transform.rotation = Quaternion.Euler(euler);

    (line 300)Vector3 adj = new Vector3(0.0f, 0.1f, 0.0f);

    if (Input.GetKeyDown (KeyCode.Alpha5))
    CameraController.transform.localPosition -= adj;
    if (Input.GetKeyDown (KeyCode.Alpha6))
    CameraController.transform.localPosition += adj;
    }


    /// <summary>
    /// Jump! Must be enabled manually.
    /// </summary>
    public bool Jump()
    {
    if (!Controller.isGrounded)
    return false;

    MoveThrottle += new Vector3(0, JumpForce, 0);

    return true;
    }

    I didn't copy/paste the whole code as I wasn't sure if it was allowed.

    Thanks for your great work Cyber.
  • I tried using this little trick again, but it seems that the check box to 'use profile height' has disappeared from the ovrplayercontroller parameters..

    Any Ideas?
  • Are you sure, because I still see it on my machine?