Archived

This topic is now archived and is closed to further replies.

Kryptus

Bounding boxes for collision

Recommended Posts

Kryptus    100
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.

Share this post


Link to post
Share on other sites
chdennis    122
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();

Share this post


Link to post
Share on other sites