Collisions with one way effects

Topics: Developer Forum, User Forum
Apr 18, 2008 at 9:20 AM
Sorry for the confusing title, I shall elaborate on what I am trying to achieve.

I am trying to model a cartoon cloud that will expand on contract when a ball flies through it. The ball should not be effected in any way by the cloud.

I modelled the cloud by starting with a central static invisible sphere which had collisions disabled. I built the clouds body using a number of low mass spheres attached by linear springs that would only collide with the ball and not other parts of the cloud.

When I fire the ball through the cloud, the cloud reacts quite nicely almost getting the effect I am after with it expanding and then contracting back together. However, despite the low mass of the spheres due to the number of them the ball can get entangled in the cloud and at the very least loses speed and deflects.

Is there any way to ensure the cloud spheres will react to a collision with the ball but the ball will not react in any way to the cloud? I was thinking I could increase the mass of the ball but would obviously still get some force applied to the ball from the cloud.

Cheers
Jim

By the way, great engine!!!
Apr 18, 2008 at 10:35 AM
I don't know if this will work, but my first guess is the following:

Define collisionhandlers for both, the cloud and the ball

in the collisionhandler of the cloud affect the cloud spheres like you wish

in the collisionhandler of the ball ignore the geoms of the cloud like:

foreach (Geom geom in CloudGeoms)
{
if((geom == g2))
return false;
}

As I said, this is just a guess.. don't know if it will work.

Greetings.
Apr 19, 2008 at 8:45 AM
Thanks for the reply Huehnerschander. Am I correct in assuming CollisionHandler is used to determine whether or not a collision should be processed by returning true or false and not to calculate the collision response?
Apr 19, 2008 at 4:40 PM
That is correct... you can handle the collisions in the collisionhandler (calculate damage, ignore special geoms, delete geoms from physicssimulator etc..) If you want the physicssimulator to do the collisionresponse after you did the things you wanted to do, then return true. If you return false, the physicssimulator will ignore the collision. You can easily test it. Just return false in any case, and your body will fall through everything, because no collision is handled anymore.