Static Body and Soft Body Collision Question

Ugras
Posts: 34
Joined: Wed Dec 30, 2009 8:30 pm

Static Body and Soft Body Collision Question

Post by Ugras »

Dear all,
I want to detect the collision between soft body and static rigid body. When there is no position change (as it is intended for) for the the static rigid body during the simulation, the collision is observed. But when I force to change the position of the rigid body using setPosition() method of RigidBody class and the position info obtained from the graphics object during the simulation, no collision is observed at all.

My intend in using static rigid body is to form a collision body that will not be affected by gravity and other forces but will interact with other rigid or soft objects. By the way there is no problem with rigids. What is the suitable way to achieve this?

Regards,
Ugras
B_old
Posts: 79
Joined: Tue Sep 26, 2006 1:10 pm

Re: Static Body and Soft Body Collision Question

Post by B_old »

You want a rigid body that is itself not affected by the dynamic simulation, but other dynamic objects should still collide against it? If I understand you correctly, you may want to look into kinematic bodies.
Ugras
Posts: 34
Joined: Wed Dec 30, 2009 8:30 pm

Re: Static Body, Soft Body Collision,customNearCallback Ques

Post by Ugras »

First of all thanks for the reply B_old. Exactly. I tried kinematic object with setting the DISABLE_DEACTIVATION flag and of course with zero mass. But during the simulation loop, when I forced to change its position via setWorldTransform, no position change occured.

The scenerio is that: there exists a user hand for manipulation of other objects. I can represent a user hand with static collision shape and define collision groups etc etc... There is no problem with rigid objects in this case. But for collision with soft bodies (2-D mesh in my case), no collision is seen. When the user hand is a dynamic collision shape, collision is seen with soft body. But as you might guess, the hand is affected by gravity and forces occured during the collision. Result is unwanted rotations and translations of hand. At the moment, my temporary solution is using 6Dof constraint and locking translation axes and allowing [-pi, pi] rotations for pitch, yaw, roll axes. By this way, the unwanted rotations and translations are absorbed by the fixed body of the constraint. The hand and its collision object seems almost ok for now and collisions are seen. But I think, there should be a better solution for this.
Any idea???

One more question, I cannot get softbody-rigidbody collision events in my customNearCallback() function. While studying the engine codes, I noticed somewhere that softbody collision events are not reported in customNearCallback(). Is that true? If yes, what should be the way? Should I raycast to every node of the softbody???

Regards,
Ugras
Ugras
Posts: 34
Joined: Wed Dec 30, 2009 8:30 pm

Re: Static Body and Soft Body Collision Question

Post by Ugras »

In addition to previous post, I set the inertia to (0,0,0).
Ugras
B_old
Posts: 79
Joined: Tue Sep 26, 2006 1:10 pm

Re: Static Body, Soft Body Collision,customNearCallback Ques

Post by B_old »

Ugras wrote:First of all thanks for the reply B_old. Exactly. I tried kinematic object with setting the DISABLE_DEACTIVATION flag and of course with zero mass. But during the simulation loop, when I forced to change its position via setWorldTransform, no position change occured.
Have you also called setCollisionFlags(btCollisionObject::CF_KINEMATIC_OBJECT) on the rigid body. Apart from that I'm using motion-states on the kinematic objects as well. Don't know whether that makes a difference. Does your kinematic object influence other rigid bodies?
Ugras
Posts: 34
Joined: Wed Dec 30, 2009 8:30 pm

Re: Static Body and Soft Body Collision Question

Post by Ugras »

Yes, besides setting DISABLE_DEACTIVATION flag, I also call setCollisionFlags(btCollisionObject::CF_KINEMATIC_OBJECT) on the rigid body. But when I try to update the position info changed via keyboard in the loop, no position change occurs.

Ps :rigidBody->getMotionState()->setWorldTransform(.......

or

rigidBody->setWorldTransform(.......

do not change the position of the collision mesh for my case.


Regards,
Ugras
B_old
Posts: 79
Joined: Tue Sep 26, 2006 1:10 pm

Re: Static Body and Soft Body Collision Question

Post by B_old »

Hm. How are you using motionstates for dynamic bodies?
I thought the normal way of doing it is to subclass btMotionState and the kinematic object will query its position by calling getWorldTransform(). Have you tried that?
Ugras
Posts: 34
Joined: Wed Dec 30, 2009 8:30 pm

Re: Static Body and Soft Body Collision Question

Post by Ugras »

Yes that's the way I use motionStates. During the rigid body allocation. I instantiate an object of a class that inherits from btMotionState. And then I initialize it with the position and orientation of the graphics mesh. Then pass the motion state object to the construction info of the rigid body. Is it a wrong way or am I missing something?
Regards,
Ugras
B_old
Posts: 79
Joined: Tue Sep 26, 2006 1:10 pm

Re: Static Body and Soft Body Collision Question

Post by B_old »

Sounds about right.
When you want to change the position of the kinematic hand, change the position of whatever is referenced by the motionstate. Bullet will then gather the result by calling getWorldTransform().
ghosting
Posts: 3
Joined: Fri Jun 25, 2010 9:07 am

Re: Static Body and Soft Body Collision Question

Post by ghosting »

Ugras wrote:Yes, besides setting DISABLE_DEACTIVATION flag, I also call setCollisionFlags(btCollisionObject::CF_KINEMATIC_OBJECT) on the rigid body. But when I try to update the position info changed via keyboard in the loop, no position change occurs.

Ps :rigidBody->getMotionState()->setWorldTransform(.......

or

rigidBody->setWorldTransform(.......

do not change the position of the collision mesh for my case.


Regards,
Ugras

try to rigidbody->setActivationState(4)