Skip to main content
GameDev.net gamedev.net
🔒 Locked

Bounding boxes for collision

Started by Kryptus Aug 8, 2003 at 9:02 AM 0 replies 250+ views
Original Post
Kryptus
Kryptus
I''ve made a person walk around in a room and have set up bounding boxes around objects to stop my character from colliding with them, this is my problem. I have made the bounding boxes and done the test and it tells me that the character has hit the objects but i need to know how to stop him from going through them. My first attempt was around the lines of: If Character Has Hit Box Then Don''t Move Any Further. but this failed as you can no longer move out of the object you just collided with. please help me out.
chdennis
chdennis
Try checking for collision before the player actually hits an object. So instead of something like:


MovePlayer();
CollisionTest( player.position );


you may want to try something like:


SetDesiredPlayerPosition();
if( !CollisionTest( player.desired_position ) )
MovePlayer();

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.