# Collison Detection and Response

Could someone please direct me to a some documentation on fast and easy collison detection?

Thanks

For simple static collisions with walls etc, the simplest method is to divide your world into a grid of squares. use an array, and assign it zero’s and ones. Idea is, for a zero, its solid. If its 1 you can walk through it. Keep track of your character’s x and y co-ordinates, every frame check what grid square it will fall into, if it moves in its current direction. If its zero, dont move it.

It’s not THAT simple because you have to make sure your camera doesn’t poke through a wall and show you the wrong side of the block… or make it look like no block is there if backface culling is on

i think this is the easyiest way for CD

# Theroy

Whell not actually theory but i put it as that what you need to do is to create a routeen that checks the camera posion against a place that is collideable.

# How i did it.

create a function called :
colliosnd(float Xpos,float Zpos)

in the main game loop pass the current camera x,z position. now check the postion against the boundry.

# a boundy

a if steatement describing a rectrangular rectrangle(no !"£) in front of said wall/object.
requires 4 pieces of inf and goes lke this

if(Xpos <= -6.0 && Xpos >= -6.2 && Zpos
>= 15 && Zpos <= 18.0)
collision = true;

this would prevent someone going through a wall that mathmatically explained like (holding the 0.2 in front of this wall)

(-6,15) (-6,18)

it is simple but described badly. for height you will need to specify two additional cooards for floor boundry.