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 4, 2016
Try (1f + JumpForce) * MoveThrottle. Unity also has some helpful resources on C# programming:
1
2
3
Inspiring
July 4, 2016
Thanks yeah. I have lot of videos tutorials and documentation. thanks. Look i'll show you picture what is happening now. By the way the code you said MoveThrottle = (1f + Jumpforce) * MoveThrottle just basicallly lounges the player a little forwards. but it doesn't give him any upward jump.

ANyways i've tried THIS:
MoveThrottle =  (1f + JumpForce) * MoveThrottle;
And that resulted in what i said
I've also tried this
MoveThrottle += new Vector3(0, transform.lossyScale.y * JumpForce, 0);

That gives no forward movement at all.

AND NOTE i want forward movement based on how fast you walking or running forwards

Anyways i've tried this

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

That results in just jumpting up and zero forward movement

and i've tried this;
MoveThrottle += new Vector3(0,0 , Vector3.z * JumpForce);
MoveThrottle += new Vector3(0, transform.lossyScale.y * JumpForce, 0);

No use. No forward movement.
If there is forward movement. it's tiny even if i push the joystick all the way forward.



Participant
July 21, 2016
Hi,

I hope I'm not too late but I just ran into this problem today and fixed it by removing this from the code (You can find this under UpdateMovement():

// No positional movement if we are in the air
if (!Controller.isGrounded)
MoveScale = 0.0f;

Inspiring
July 21, 2016
Thanks I'll try it!!!!
Participant
July 21, 2016
I said remove that code, not insert.

In the original script, if the character is not grounded, the Move Scale is set to 0.0f which is why you jump up and come back down without any forward or backward motion. 

Commenting out those lines of code will give you momentum when you jump.

Thanks but does that also fix the fact the the jumps are really quick like BAM to the air BAM back down.
No it does not fix the fact that jumps are very unrealistic. I'm still thinking of a way to fix that.
Inspiring
July 21, 2016
thanks for the response. yeah i know what you meant.  I'm also trying tofix it. Tried looking at physics examples of jump done in other games but they usually use RIgidbodies and thats a different way of doing it. the OVR character contrller is not a rigidbody. Also i've tried checking 2D video games of how they do jumps in 2D games but as i am not a good scripter i don't know how to do that either.
Participant
July 22, 2016
Alright I have something figured out which seems to be working a lot better.

In your OVRPlayerController, (might be line 187), look for:
MoveThrottle.y = (MoveThrottle.y > 0.0f) ? (MoveThrottle.y / motorDamp ) : MoveThrottle.y;
and change it to:
MoveThrottle.y = (MoveThrottle.y > 0.0f) ? (MoveThrottle.y / motorDamp * 1.2f) : MoveThrottle.y;
Next, adjust your Acceleration, Jump Force and Gravity Modifier to improve it as much as you can.

I'm using Acceleration = 0.25, Jump Force = 0.45 and Gravity Modifier = 0.23

I'm still playing around with these values to make it as realistic as possible but I think this should give you a good start.
Inspiring
July 22, 2016
Thanks Shan. i'll do it!!!
Inspiring
July 22, 2016
Hey Shan that was pretty good EXCEPT in mine it keep jumping and jumping after it lands. Wonder why. I did some of the tips that people told me(you) before like  remove the
// No positional movement if we are in the air
if (!Controller.isGrounded)
MoveScale = 0.0f;

But yeah currently it's like bouncing. great jumps but bounces endlessly. Also, the jumps are super high

Inspiring
July 22, 2016
Shan could i show you my code? I don't know why it's bouncing. and i only press the button once. Maybe i'm doing something you're not. i can see it's an excellent jump but just that in my side.....it's bouncing over and over after one press. That doest seem like it's happening to you