Forum Discussion

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

Enabling Jump!

Hello all,

My novice programming skills have come by to ask how to enable Jumping for the OVRPlayerController

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

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

return true;
}


Plz halp!
Thank you,
Alex

2 Replies

  • You just call the jump function from your code somewhere.

    For example, you can add this to the bottom of Update() in OVRPlayerController.cs:

    if (Input.GetKeyUp (KeyCode.Space)) {
    Jump();
    }


    You probably also want to disable the "OVR Debug Info" component in the inspector (so you don't get the UI when pressing space) and you can also adjust the gravity and jump parameters as well.

    However, just keep in mind that the jumping does not work that great and you'll have to make serious modifications if you want to use it in a game.