how do I check if the 3D player touching/clashing antoher object ?

Started by
1 comment, last by Wh0p 9 years, 6 months ago

how do I check if the 3D player touching/clashing anther object ? or any object like ball or box .

what is the best way to do that ? should I comapre all the vertexs ?

Advertisement

No. You want to do the least possible amount of work to determine whether two objects collide so in general checking each and every vertex every frame would be a bad idea. The typical approach is to surround each object with a *much* simpler shape that defines the collision bounds for the object. Popular choices are spheres and axis-aligned bounding boxes. There are *very* efficient algorithms for determining whether these shapes intersect with each other.

This is a big topic but you should be able to find plenty of information and tutorials on the Internet. Try some Google searches for "collision detection", "axis-aligned bounding box", and "oriented bounding box".

Have a look into bounding volume hierarchies to further speed up the detection process. Common tree structures are BVHs, octrees and kd-trees.

This topic is closed to new replies.

Advertisement