How can I move an static CollisionObject/RigidBody?

nolver
Posts: 1
Joined: Fri May 25, 2007 4:55 pm

How can I move an static CollisionObject/RigidBody?

Post by nolver »

I know this is a very noob question, but I had a look all over the forum and didn¡t find the answer.

I have a build a closed "room" out of static boxes (collisioObject with mass=0) and spawned a ball inside it. When I apply forces to the ball they behave as expected, it collides with my room's walls fine.

So far so good, now I'm trying to add another static object (mass=0), a box that I want to move with the gamepad directly, and causes the ball to collide with it.

Can I apply new positions to that box directly? I'm trying to set the world matrix on the motion state, but that didn't worked.

What is the right way to reposition an static object?

Thanks in advance!
User avatar
Erwin Coumans
Site Admin
Posts: 4221
Joined: Sun Jun 26, 2005 6:43 pm
Location: California, USA

Post by Erwin Coumans »

Please check 'kinematic' objects by enabling 'USE_KINEMATIC_GROUND' define in Bullet/Demos/CcdPhysicsDemo/CcdPhysicsDemo.cpp or search kinematic in the forums.

Alternatively, you can also use a constraint (similar to picking in Bullet/Demos/OpenGL/DemoApplication.cpp). That gives better 2-way interaction.

Hope this helps,
Erwin