Is there any possibility to....

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

Is there any possibility to....

Post by Jack »

Is there any possibility to:

1) Prohibit body to move across one of the main axises (X, Y, or Z)?
2) Prohibit body to have angular velocity?
User avatar
Erwin Coumans
Site Admin
Posts: 4221
Joined: Sun Jun 26, 2005 6:43 pm
Location: California, USA

Re: Is there any possibility to....

Post by Erwin Coumans »

Jack wrote:Is there any possibility to:

1) Prohibit body to move across one of the main axises (X, Y, or Z)?
Yes, you can use the btGeneric6DofConstraint to do this. Just lock 1 axis, and leave 2 linear axis free.
Jack wrote: 2) Prohibit body to have angular velocity?
This can be done with the btGeneric6DofConstraint too, just lock the 3 angular axis.

Another solution is to prevent impulses to add angular velocity. This can be handy for a basic character controller.
Use btRigidBody's setAngularFactor and set it to zero.

Hope this helps,
Erwin
Jack
Posts: 59
Joined: Thu Aug 31, 2006 11:51 am

Post by Jack »

btGeneric6DofConstraint requires second body. But what if I have no second body? Second body is World....
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:btGeneric6DofConstraint requires second body. But what if I have no second body? Second body is World....
You can provide a static rigidbody, with mass 0, and no collision shape. I'm pretty busy otherwise I would give you some samplecode, but there must be some sample/snippet that does this.

Hope this helps,
Erwin