PDA

View Full Version : how to prevent to through a wall or shape?



omegafox
12-16-2003, 07:37 AM
I want to stop at cube suface while I am zooming. I dont want to go through the cube like a walking through a wall. Can you tell what is best possible solution for this. Thank you in advance.

maximian
12-16-2003, 08:56 AM
You need collision detection for this feature.

Your simplest approach is to define a sphere with a diameter equal to cube side, and then a sphere of the size of the viewer avatar(ie imaginery viewer). Then check to see if the two spheres intersect. Google for this topic, there are way too many issues to cover in thread, and plenty of source code to show you how to do it online.