Skip to main content
Up and Coming
July 24, 2015

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

    Inspiring
    July 24, 2015
    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.
    AMD Ryzen 7 1800X | MSI X370 Titanium | G.Skill 16GB DDR4 3200 | EVGA SuperNOVA 1000 | Corsair Hydro H110i Gigabyte RX Vega 64 x2 | Samsung 960 Evo M.2 500GB | Seagate FireCuda SSHD 2TB | Phanteks ENTHOO EVOLV
    Up and Coming
    July 24, 2015
    Thank you Cyber, you are a great help.