Vertical static planes

Jack
Posts: 59
Joined: Thu Aug 31, 2006 11:51 am

Vertical static planes

Post by Jack »

I've started my new game with bullet :) And discover something strange with vertical static planes.

Situation:
Room built of 5 static planes. Top, Bottom, Left, Right and Rear.
Gravity: btVector3(0, -9.8f, 0)
SPHERE inside the Room. SPHERE has some starting linear velocity. SPHERE is jumping inside the room reflecting from static planes. It reflects OK from Top and Bottom horizontal planes. But when it touches vertical wall, it does not reflect correctly. It is "glued" to vertical wall and jumps in vertical direction near the wall.

Sometimes also SPHERE becomes to gain energy from "nothing" (it jumps faster and faster). But it depends. I think it happends when Restitution=1
Jack
Posts: 59
Joined: Thu Aug 31, 2006 11:51 am

Post by Jack »

Something terrible with setLinearVelocity!

In appCcdPhysicsDemo, in localCreateRigidBody add before return:

body->setLinearVelocity(btVector3(1,6,1));

And see that crazy dance. They are jumping and jumping. They can not stop. They are gaining impulse from nothing....
User avatar
Erwin Coumans
Site Admin
Posts: 4221
Joined: Sun Jun 26, 2005 6:43 pm
Location: California, USA

Post by Erwin Coumans »

Jack wrote:Something terrible with setLinearVelocity!

In appCcdPhysicsDemo, in localCreateRigidBody add before return:

body->setLinearVelocity(btVector3(1,6,1));

And see that crazy dance. They are jumping and jumping. They can not stop. They are gaining impulse from nothing....
It's not that terrible, more funny :-)

I added an assert so that you don't setLinearVelocity on static objects, like the ground. Bullet 1.x had support for kinematic objects (non-dynamic but with velocity). Due to removal of CcdPhysicsEnvironment, Bullet 2.x doesn't have this feature yet. It will be added soon. Then the ground will just move as well, without this funny behaviour.
Bullet 2.12 will have this check, and also other improvements. it will be released later today.

Thanks again for the feedback!
Erwin