I’m looking for the math that give me the direction in which i’m crossing a body.
I’m out of ideas, I know it must be very simplistic application of trigonometry but I tried various things without success.. Not sure what is the best approach.
Here the details:

So I have a body that is rotated at a given angle and I need to find out if i’m entering the body from it’s back or from it’s front.
The trajectory in this use-case is defined by the mouse position (on move), therefore I can draw a line from the previous Point and the current Point.
Hope someone can help me with this:) & Thanks very much in advance.
This can be solved using a few vector operations. First of all, construct a vector representing the movement.
Then to see whether it aligns with the orientation of the body (specified by ‘normal’, the normal vector on the front of the body), just use the dot product: if
movement dot normal > 0, movement is in the direction of the normal on the front, so it hits the body from the back. Otherwise it hits the body from the front.Note that we do not normalize any vectors, that is not needed when you just want to know whether it hits the object from back or front. A nice bonus is that when you normalize
movement, (I assume thatnormalis already normalized), the dot product betweenmovementandnormalrepresents the incident angle:angle = arccos(movement dot normal)Edit
This approach handles a relative movement so you still need to test for intersection with the object to know whether you hit it at all. To achieve this, test for line-object intersection. (Depends on your object so I can’t really say a lot more about this.)