1

Closed

Body rotation is counterclockwise?

description

Farseers coordinate system appears to rotate objects counterclockwise when a POSITIVE rotation is applied to them. This is counter-intuitive and also counter to XNA standard.
            body.Rotation = MathHelper.ToRadians(0);
            body.GetTransform(out bodyTransform);
            yaxis = bodyTransform.q.GetYAxis();
            xaxis = bodyTransform.q.GetXAxis();
            // xaxis = (1,0)
            // yaxis = (0,1)

            body.Rotation = MathHelper.ToRadians(90);
            body.GetTransform(out bodyTransform);
            yaxis = bodyTransform.q.GetYAxis();
            xaxis = bodyTransform.q.GetXAxis();
            // xaxis = (0,1)
            // yaxis = (-1,0)

            /// .... so rotating a body by 90 degrees made it rotate counterclockwise??
Even though this behavior could be argued as 'up to personal preference' I actually disagree, its just wrong. If this 2D scene were being viewed by a 3D camera, the camera would have to be looking UP the positive z axis for the rotation to appear clockwise. However, the xna standard for a camera matrix is that +z is DOWN not up.
Closed Aug 30, 2014 at 10:12 PM by genbox
The coordinate system that has been chosen by XNA does not conflict with the math in the engine. It is 100% up to the camera transformations which way a body rotates when a value is applied. Also, FPE does not depend on XNA.

comments

evinism wrote Jul 5, 2014 at 5:17 PM

Correct me if I'm wrong, but XNA's coordinate system can be described as left handed, whereas farseer's is right handed. It would make very little sense mathematically if rotation were the only thing in the right handed coordinate system that operated in a left handed fashion. You know, instead of Torque being Lever arm cross Force, as it is in almost all physics textbooks, it would be Force cross Lever Arm, and that personally would infuriate me much more. So I don't think it's personal preference, I think it's mathematical consistency.

wrote Aug 30, 2014 at 10:12 PM

jamesford42 wrote Aug 31, 2014 at 5:04 AM

@evinism - Correct. I guess I'm saying, "why isn't FPE the same handedness as XNA, for which it is designed to be used".
@genbox - FPE does not depend on XNA? It uses Matrix, Vector3, Quaternion, and other XNA types. When I say XNA I mean XNA/MonoGame (MonoGame is also left-handed).

If FPE was a math library, and there is a right-handed standard in academic math, then using a right-handed coordinate system would be intuitive. But as far as I can tell, everyone who uses FPE does so in XNA/MonoGame, for which a right-handed coordinate system is counter-intuitive.

I'm not saying that makes it unusable, but its a huge source of errors, when you accidentally do vector math between a 'world vector' and a 'physics vector'.