Jump to content
  • Advertisement

Archived

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

Kryptus

Bounding boxes for collision

This topic is 5527 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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
Advertisement
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

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!