Beginner Bullet Question

Physics APIs, Physics file formats, Maya, Max, XSI, Cinema 4D, Lightwave, Blender, thinkingParticles™ and other simulation tools, exporters and importers
Post Reply
ynie
Posts: 2
Joined: Sun Jan 08, 2012 11:00 pm

Beginner Bullet Question

Post by ynie »

Hey everyone, I started to use bullet not long ago, and I have some questions for bullet.

1) Is it possible to to set the gravity so that the speed of falling object is constant?
2) I'm not sure what's the best way to implement moving a object manually. In other words, Say there's a cube falling down, and there's a static platform at the bottom. I want to be able to rotate and move the platform but also keep the physics collision. I don't think applyImpulse is a good idea because i want to set the final destination of the rigid body. Thanks!

Steven
Kukanani
Posts: 25
Joined: Sat Feb 21, 2009 5:08 am

Re: Beginner Bullet Question

Post by Kukanani »

1) By definition, gravity is an acceleration, not a velocity. So if you want something to fall at a constant speed you can't use gravity.

2) It's been a while since I've programmed Bullet but I believe there's a setPosition method for rigid bodies. I'm sure it exists, not sure of the exact function name or usage. If you want to move a plane, don't use a static plane, use the surface of a very large box.
ynie
Posts: 2
Joined: Sun Jan 08, 2012 11:00 pm

Re: Beginner Bullet Question

Post by ynie »

Kukanani wrote:1) By definition, gravity is an acceleration, not a velocity. So if you want something to fall at a constant speed you can't use gravity.

2) It's been a while since I've programmed Bullet but I believe there's a setPosition method for rigid bodies. I'm sure it exists, not sure of the exact function name or usage. If you want to move a plane, don't use a static plane, use the surface of a very large box.

Hey Kukanani,

Thanks for the reply.

1) If there's no gravity, then the object will not fall down right?
2) I'm using btConvexHullShape for the platform, and the mass is 0. The following code will not change the position of the rigidbody.

Code: Select all


// code for creating rigidbody.
	Isgl3dMotionState * motionState = new Isgl3dMotionState(node);
	
	// Create a rigid body
	btVector3 localInertia(0, 0, 0);
	shape->calculateLocalInertia(mass, localInertia);
	btRigidBody * rigidBody = new btRigidBody(mass, motionState, shape, localInertia);
	rigidBody->setRestitution(restitution);
	rigidBody->setActivationState(DISABLE_DEACTIVATION);


// code for moving object.
btTransform tr;
rigidBody->getMotionState()->getWorldTransform(tr);
tr.setOrigin(btVector3(btScalar(object.node.x), btScalar(object.node.y), btScalar(object.node.z)));
rigidBody->getMotionState()->setWorldTransform(tr); 
I've also set

Code: Select all

  physicsPlatform.rigidBody->setActivationState(DISABLE_DEACTIVATION);
when I created the rigidbody. Thanks!

Steven
Post Reply