Author Topic: [JBullet] A new rigidBody problem.  (Read 1306 times)

Offline Gohome

  • byte
  • *
  • Posts: 5
    • View Profile
[JBullet] A new rigidBody problem.
« on: August 06, 2012, 10:59:03 am »
I have a cylinder object with its rigidBody on a plane. I want to move this object without physics.  But the object seems to locked by its rigidBody. It means I only can move the object by moving its rigidBody with setLinearVelocity(). This is not what I want.  So, I stop simulate physics and remove its rigidBody when I move the object. And when I drop it, I restart the sumulation and add a new rigidBody to the object. This solution runs good, but here comes the problem.

According to the requirement of my program, this object is upside down when it moves.(Fliped) But when I drop it, the object upside down again.(Not Fliped) It is not correct. And I can not find out any functions to set the initial rotation of the new rigidBody. Is this problem have any solutions?

Offline kbjansen

  • byte
  • *
  • Posts: 37
    • View Profile
Re: [JBullet] A new rigidBody problem.
« Reply #1 on: August 16, 2012, 11:38:09 am »
I have a cylinder object with its rigidBody on a plane. I want to move this object without physics.  But the object seems to locked by its rigidBody.
One way is to use a Kinematic rigidbody: more here
If you want to use Kinematic rigidbodies, you need to do the following:
Code: [Select]
//PSEUDO CODE:
float rigidbodyMass = 0;
//...some operations to create the rigidbody and assign the rigidbodyMass to it (I guess you know how to do that)

rigidbody.setCollisionFlags(carCollider.getCollisionFlags()|CollisionFlags.KINEMATIC_OBJECT);
rigidbody.setActivationState(CollisionObject.DISABLE_DEACTIVATION);

dynamicWorld.addRigidBody(rigidbody);

Quote
According to the requirement of my program, this object is upside down when it moves.(Fliped) But when I drop it, the object upside down again.(Not Fliped) It is not correct. And I can not find out any functions to set the initial rotation of the new rigidBody. Is this problem have any solutions?
Honestly, I don't get the whole problem. But keep in mind that there is a difference according to the world axes of jPCT, jBullet and for example 3DS-Max. I've attached an image that should explain the difference.




[attachment deleted by admin]