Take the 2-minute tour ×
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

I am using Ogre3D as my rendering API, and OgreBullet as my physics engine.

I have an test entity that when the y part of the velocity is 0 and spacebar is pressed, the velocity changes to, lets say: (10, 10, 0) that is a forward jump.

The thing is that when it arrives to the ground, instead of staying still (like any normal human jump) it bounces like a box and changes orientation.

What would be the correct way of implementing a human-like jump in 3D? I fixed it using a if() in the update loop that sets the y-velocity to 0 if it touches the ground, but this doesn't seem the correct way of doing it.

share|improve this question
1  
You might want to look at bullet Kinematic Character Controllers, which model human character physics better than a simple rigid body –  Nathan Baggs Jun 10 '13 at 8:33
add comment

2 Answers

up vote 1 down vote accepted

No, setting the y-velocity isn't the correct way of doing things. You need to set the restitution of the object by passing the correct value (0 = no bounce) into the btRigidBodyConstructionInfo which is passed into the rigid body.

share|improve this answer
    
I set it to 0 and it still bounces a little –  Pacha Jun 9 '13 at 21:59
    
pastebin.com/XQEaSeFr –  Pacha Jun 9 '13 at 21:59
    
Have you ensure the colliding floor has a value of 0 as well? –  Vaughan Hilts Jun 9 '13 at 22:00
    
Yes. Full code here: pastebin.com/CnTgUfMD friction is 1 though, although I think that shouldn't affect it too much. Maybe I am doing something wrong? –  Pacha Jun 9 '13 at 22:01
    
When I change the restitution to a higher value (0.5f, for example), the bounce is way larger. When it is 0 it is small, but it still bounces a little. I just want no bounce at all, which is my main problem –  Pacha Jun 9 '13 at 22:07
show 3 more comments

I read somewhere on the Bullet forums that a certain amount of bounce velocity is nearly always added to deal with overlapping (I'll find the source if I can but for now you might have to take my word for it). I think the only way to avoid this is indeed to set the y velocity to 0, or set it to the same as the whatever your object lands on (if you are jumping on moving objects). This might also mean you need to resolve overlapping yourself, however, by moving the object upwards a certain amount.

share|improve this answer
    
I used a ghost object and a character controller interface –  Pacha Jun 19 '13 at 1:57
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.