CollisionHandlerPusher push issue

I am making a fish game.

The fish will be fed with food. The food is implemented as a small sphere.
To avoid the food passing through the fish, I use CollisionHandlerPusher.

Most of time it works well. However, sometimes I find that the “food” is pushed inside the body of fish and got trapped there. How can I avoid it ?

Thank you.

Probably best to use a well-behaved solid, like a sphere or a tube, to represent the fish itself, instead of polygons. That way, it will be impossible for anything to get trapped within the fish.

David

Yes, I find that also last night.

But Tube to Tube collision in pusher seems not implemented, the only choice left is sphere. And the sphere is a perfect sphere, cannot scale in any axis. It seems a bit limited.

Yes, it is rather limited. For the purpose of feeding fish, though, isn’t it sufficient just to have a small collision sphere where the fish’s mouth is? You don’t necessarily need to test for collisions between the food and the back of the fish.

David

But I have a few fishes swimming in the tank.

I am now using 3 spheres per fish for the purpose (can see the end of the video). Is it a right way to do it ?

youtube.com/watch?v=b-sh_GZd_DI

It is a fine solution.

You could also put tubes and spheres around each fish: an “into” tube around the body to stop other fish, and a “from” sphere just in the front to detect forward collisions. Assuming, of course, your fish never swim backwards or sideways.

David