Public Group

# 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.

## 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 on other sites
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 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.

1. 1
2. 2
Rutin
20
3. 3
khawk
16
4. 4
A4L
14
5. 5

• 11
• 16
• 26
• 10
• 11
• ### Forum Statistics

• Total Topics
633756
• Total Posts
3013707
×