Posts

Showing posts from November, 2009

Pseudo orientation in Farseer Physics Engine

Image
Farseer Physics Engine does not know about its object’s orientation. It has no clue about what is up and what is down. It only needs to know where other objects are in the physics world – nothing else. Sometimes it is good to know what is left, right, top and bottom. In this blog post I will describe a way of determining the side on which an object is hit, no matter the rotation of the object. Let’s take a simple box as an example: We can easily determine what is left, right, top and bottom on that box. We do it all the time in the real world. In geometry though, we need to calculate it. Imagine a circle inside the box. This circle is made up of 360 degrees or 2*π in radians. We can now use this circle to find out where the box was hit (left, right, top, bottom) by determining the angle at which the other object hit. A good reference to how radians are laid out on a circle can be found on Wikipedia . Now we end up with something like this: Now we need to determine the