Jump to content
  • Advertisement
Sign in to follow this  
MadsGustaf

Contact vector and rotation.

This topic is 3913 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

Hello. I have two polygons (lets just say squares). I only want to handle collision response if the square is colliding against one specific side. Without rotation, i would just look if the contact vector was above or equal to the squares top border coordinates. When the squares are rotating, i am not quite sure how i would do this. [Edited by - MadsGustaf on April 1, 2008 12:16:57 PM]

Share this post


Link to post
Share on other sites
Advertisement
Each side of a polygon is a line segment. So I think you can just do a polygon-line segment collision test, which itself is just:
- if either end of the line segment is inside the polygon, there is a collision
- otherwise, if any of the edges of the polygon intersect the line segment (a series of line segment-line segment intersection tests), there is a collision

Share this post


Link to post
Share on other sites
This is what i would want:

Click Me

in case 1) i dont want to handle any specific collisions (as the green square does not intersect with the side of the red square outlined by the blue line). This is what i currently have on all sides of the square.

In case 2) the green square does intersect the blue line of the red square, so i would like to proceed a special collision response, but how do i determine if the green square is oversecting the blue line at any rotation?


The general physics collision/response is handled by the physics engine, but i have acces to the vertices of the squares, rotations and contact vectors.

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.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!