Age Old Question - How To Jump — Oculus
Welcome to the Oculus Developer Forums!

Your participation on the forum is subject to the Oculus Code of Conduct.

In general, please be respectful and kind. If you violate the Oculus Code of Conduct, your access to the developer forums may be revoked at the discretion of Oculus staff.

Age Old Question - How To Jump

Hiro_Protag0nistHiro_Protag0nist Posts: 4,681 Valuable Player
OK, can't believe i can't find this online - i'm using 2018.3.  What script to i have to add to OVRPlayerController.cs to enable jumping with the A button, which i think has the ID 0?  Unfortunately i just  don't know how to program/script.

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

        MoveThrottle += new Vector3(0, transform.lossyScale.y * JumpForce, 0);

return true;

Many thanks.

Comments

  • Hiro_Protag0nistHiro_Protag0nist Posts: 4,681 Valuable Player
     :( 
  • StefferpStefferp Posts: 3 Oculus Start Member
    edited May 15
    Just put this somewhere in the Update method of OVRPlayerController
    if (OVRInput.GetDown(OVRInput.Button.One))
       Jump();
  • Hiro_Protag0nistHiro_Protag0nist Posts: 4,681 Valuable Player
    Wonderful!  Now, I don't want to push my luck but the player now just drops from the jump - i've poked around Gravity in the OVRPlayerController script but can't find what to alter to make it a more curved return to the ground.
Sign In or Register to comment.