- Joined
- Jul 6, 2009
- Messages
- 1,885
I'm making a movement system and i can't solve a problem.
I'm trying to make an object deflect off edge of a rectangle. (Coordinates of vertices are known; rectangle isn't static and is, in most cases, rotated.)
The main problem is i can't get the angle of perpendicular on rectangle edge (The red line).
Each time i move the object, i check if the object's coordinates are within the rectangle, if they are, a collision occurs and i need to change the object's movement vector, but i need the perpendicular's angle for that. Anyone knows how to retrieve it?
+rep for help.
I'm trying to make an object deflect off edge of a rectangle. (Coordinates of vertices are known; rectangle isn't static and is, in most cases, rotated.)
The main problem is i can't get the angle of perpendicular on rectangle edge (The red line).
Each time i move the object, i check if the object's coordinates are within the rectangle, if they are, a collision occurs and i need to change the object's movement vector, but i need the perpendicular's angle for that. Anyone knows how to retrieve it?
+rep for help.