Collision detection 3d and 2d

How to make it so that the model does not go beyond the intended boundaries?
How can I do the collision detection?

Thanks!

For 2D I would use a second texture solid colour for representing areas character cannot traverse and transparent for areas player can move, then use per pixel collision to determine if any of the none transparent pixels of the player texture overlap a none transparent pixel of the second texture signifying they hit bounds.

For 3D Id probably use bounding boxes to line the edges of the path then check for intersection with the players bounding box to determine if they hit the bounds.

http://xbox.create.msdn.com/en-US/education/catalog/tutorial/collision_2d_perpixel


http://xbox.create.msdn.com/en-US/education/catalog/sample/collision_3d_heightmap

1 Like