Skip to main content
Inspiring
July 3, 2016
Solved

How do you enable Jump in OVRCharacterController?

  • July 3, 2016
  • 33 replies
  • 8777 views
I noticed the class OVRInput.cs has a Jump() method and it says in comments that you must enable it. Where do i enable it?

But also in INput settings JUMP it's set to joystick 3...what exactly is joystick 3 in the xbox one controller?  seems from pictures i saw that is the Y button. but different pictures say different things.
This topic has been closed for replies.
Best answer by vrdaveb
You mean OVRPlayerController? Try adding code like the following to OVRPlayerController.Update():
if (Input.GetKeyDown(KeyCode.Space)
    Jump();

33 replies

Inspiring
July 3, 2016
Hey vrdaveb THANKS ALOT> Finally workeD!!!!!!  now it jumps. The jumps are fast and not very high but i can figure out how to change by changing the up force. if i want. Thanks alot!
Inspiring
July 3, 2016
I did multiply JumpForce* 4 to make it at least reach a default cube's top.  But i'm noticing the jump is just quickup quick down. like it doesn't follow gravity rules. Anyway to make it a more realistic jump?
Inspiring
July 3, 2016
Actually Jumpforce * 4 worked well. i reached the defautl cubes. But the jump is kind of unrealistic. Now i set Gravity modifier to 0.5 instead of default 1 and it's much better but   the movement UP is faster, then the falling down. that's kind of nonrealistic
Inspiring
July 3, 2016
The way OVRPlayerController implements jumping is optimized for comfort. In reality, you would be continually accelerating -9.8m/s ^2 on the Y axis, but that would make the user nauseous, so it tries to maintain a constant velocity as much as possible.
Inspiring
July 3, 2016
Oh I seee......................Ok thanks very much for the info. I just have one little question. How do you jump forwards while moving forwards i can't seem to get it . the jump method is this but i don't know how to modify it so that i can jump forwards too(if i first press and hold forwards, then press the jump key)









public bool Jump()

    {

        if (!Controller.isGrounded)

            return false;



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



        return true;

    }




It seems when you push forwards and then keep pressing forwards and jump. it stops and does a straight up jumpinstead of a forward jump


Inspiring
July 3, 2016
If you always want the jump to be forward, you could swap the Y and Z components of the Vector3 there. Or you could just scale the existing MoveThrottle by JumpForce. Then you would have to tweak JumpForce to get the right value.
Inspiring
July 3, 2016

vrdaveb said:

If you always want the jump to be forward, you could swap the Y and Z components of the Vector3 there. Or you could just scale the existing MoveThrottle by JumpForce. Then you would have to tweak JumpForce to get the right value.


No i don't want to always jump forward, only when the user moves forward
Inspiring
July 3, 2016

vrdaveb said:

If you always want the jump to be forward, you could swap the Y and Z components of the Vector3 there. Or you could just scale the existing MoveThrottle by JumpForce. Then you would have to tweak JumpForce to get the right value.



Hey i wonder how , what variable is the speed the player is going at a given movment. Cause i could use it
in MoveThrottle += new Vector3(0, transform.lossyScale.y * JumpForce , 0 );
and maybe add or multiply something to the Z value instead of letting it jut be zero
Inspiring
July 4, 2016
what variable is the speed the player is going at a given movment.
That's MoveThrottle. You could use something like the following:
MoveThrottle = Vector3.Scale(MoveThrottle, 1f + JumpForce);

Disclaimer: I haven't tested this.

Inspiring
July 4, 2016
Nice thanks so much. Except i get errors because it says the use is   Vector3.Scale( Vector a, Vector b).
and Jumpforce is not a vector, so should we change something there? On top declaration says Jumpforce is a float