www.jpct.net

jPCT-AE - a 3d engine for Android => Support => Topic started by: bili on July 05, 2012, 09:31:43 pm

Title: collision detect one against other objects
Post by: bili on July 05, 2012, 09:31:43 pm
I just wonder on how to do collision for the following scenario. I got one main cube moving along the horizontal line and 5 other cubes moving along the vertical line at different position i.e. not in the same line. I want to test the collision between the main cube and other cubes so that if any other cube collides with the main cube, i will set it visibility to false.

How should I do this?

I already set collision mode for main cube to self and other cubes to others.

Thanks.
Title: Re: collision detect one against other objects
Post by: EgonOlsen on July 05, 2012, 09:42:19 pm
Just use one of the collision detection methods that fit. In case of a cube, the spherical approach might be sufficient. It won't be exact, because a sphere isn't a perfect approximation of a cube, but it should be good enough. Another way would be to detect the collisions yourself based on the cubes position. This is almost trivial if the cubes don't rotate and comes down to a few simple distance checks.
Title: Re: collision detect one against other objects
Post by: bili on July 07, 2012, 08:42:13 pm
Thx it works.

I use a loop to check for collision between other cube and the main cube and set collided cube visibility to false.