# collision detection

hi need some help with collision detection

Using a cube i have a character moving around the cube but I want to implement collision detection for when it reaches the boundry of the cube.

Anybody know how to do this?

HI

Try a search of this site and forum or even a straight google, as collision detection has been discussed many many times from simple to advanced

Dear,

The following solution might be some use.

construct an Axis Aligned Bounding Box around your charcter (There are many sites where you can find algorithms for constructing an AABB for a given primitive and then check for collision between the cube and AABB of character by comparing their extremas. Algorithm is given below

Check_intersection (box & A, box &B)
{
if(A.max < B.min || A.min > B.max )
{
printf(“No Collisionn”);

``````}
else
{
printf(“Collision”);

}
``````

}

Collision Response is depends exclusively on your requriement.

Hope this helps

Rajesh.R
IRIS,CAIR, Bangalore
rajeshr@cair.res.in

Collision detection isnt a gl issue really… It’d be better if you searched on places like gamedev/flipcode where they have more general areas devoted to things like game issues, sound, AI, etc, you should be able find more specific info there

Edit: If you’re hoping to do something more global, like a quake-style 3D walkthrough, I’d suggest looking up info about BSP trees and collision with planes, brushes.

Originally posted by Andrew Waller:
[b]hi need some help with collision detection

Using a cube i have a character moving around the cube but I want to implement collision detection for when it reaches the boundry of the cube.

Anybody know how to do this?[/b]