Jump to content
  • Advertisement
Sign in to follow this  
Zerod

Collision handling with Rotated Rectangles

This topic is 2567 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 am about to develop a little 2D game. The perspective is top Down like, so you can only see the Had of the player. You can move the Player with WASD and he and his Collision Box Rotates, in the Center of the Player, to the mouse Position. In the World are some rotated Walls, by which the Player can collide with.

I have a function for the Collision detection with 2 rotated Rectangles, but i don't know how to handle it.

Has someone a function, with takes the 2 rotated Collision boxes and gives me the right position back. Or has someone an example for such a problem?

I need some help.

Share this post


Link to post
Share on other sites
Advertisement
At least 3 reactions can be implemented.

* Set the mobile collider back in opposite direction of its original movement until the collision is nullified, and cancel the current movement. This method let the collider look like avoiding collision simply by stopping.

* Set the mobile collider back in direction perpendicular to the obstruction until the collision is nullified, and cancel the current movement. This method let the collider look like it really hit the obstruction.

* Set the mobile collider back in direction perpendicular to the obstruction until the collision is nullified, and continue the movement only with the component parallel to the obstruction's shape at the location of contact. This method let the collider slide along the obstruction.

All methods above can be combined with a correction of the line of sight.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

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

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!