1
\$\begingroup\$

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.

\$\endgroup\$
1
  • 1
    \$\begingroup\$ You might want to look at bullet Kinematic Character Controllers, which model human character physics better than a simple rigid body \$\endgroup\$ Commented Jun 10, 2013 at 8:33

2 Answers 2

1
\$\begingroup\$

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.

\$\endgroup\$
8
  • 1
    \$\begingroup\$ I set it to 0 and it still bounces a little \$\endgroup\$ Commented Jun 9, 2013 at 21:59
  • \$\begingroup\$ pastebin.com/XQEaSeFr \$\endgroup\$ Commented Jun 9, 2013 at 21:59
  • \$\begingroup\$ Have you ensure the colliding floor has a value of 0 as well? \$\endgroup\$ Commented Jun 9, 2013 at 22:00
  • \$\begingroup\$ 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? \$\endgroup\$ Commented Jun 9, 2013 at 22:01
  • \$\begingroup\$ 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 \$\endgroup\$ Commented Jun 9, 2013 at 22:07
0
\$\begingroup\$

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.

\$\endgroup\$
1
  • \$\begingroup\$ I used a ghost object and a character controller interface \$\endgroup\$ Commented Jun 19, 2013 at 1:57

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.