oddrose
02-06-2009 18:47:53
Hi,
I'm wondering how to detect the collision of two objects, but just the impact really. I'll explain.
Imagine that you have a ball dropping down on a flat surface. At the the time of impact I want to trigger a function, e.g. a counter for how many times the ball has bounced on the ground.
My problem is that if for instance the ball stops at the surface the ContactCallback functions keep getting called. (I guess it is bouncing with very low height).
I want to make sure that I only call the functions that should be called on impact once and not more. Again, with the ball example, imagine that every bounce in a tennis game counts as two. Not very fun to play.
I guess in the case of the ball you could just set a threshold on the velocity or altitude of the ball so that when small enough, the bounces doesn't count. Do you think that this would work in the general case? Am I guaranteed low velocity in the collision if the ball is lying (seemingly still) on the surface?
I hope you can help me!
I'm wondering how to detect the collision of two objects, but just the impact really. I'll explain.
Imagine that you have a ball dropping down on a flat surface. At the the time of impact I want to trigger a function, e.g. a counter for how many times the ball has bounced on the ground.
My problem is that if for instance the ball stops at the surface the ContactCallback functions keep getting called. (I guess it is bouncing with very low height).
I want to make sure that I only call the functions that should be called on impact once and not more. Again, with the ball example, imagine that every bounce in a tennis game counts as two. Not very fun to play.
I guess in the case of the ball you could just set a threshold on the velocity or altitude of the ball so that when small enough, the bounces doesn't count. Do you think that this would work in the general case? Am I guaranteed low velocity in the collision if the ball is lying (seemingly still) on the surface?
I hope you can help me!