   Cos/Sin reversed
  I have it setup so that the sprite gets its position and rotation from a body generated by a physics engine. However when I try working with sin and cos they seem to be backwards.b2Vec2 Object::GetDirection(float mag){b2Vec2 dir;dir.x = cos(GetRotation()) * mag; dir.y = sin(GetRotation()) * mag;return dir;}Cos seems to return the vertical direction of the sprite based on the angle while sin the horizontal. Also the sprite rotates in the opposite direction of the body. I am not sure if the this is related. The sprite when loaded is facing upwards. Are there reasons for this oddities?Thanks.[Edited by - Antonym on May 22, 2009 5:44:31 AM]
  Conventionally (mathematically), the angle of a vector is defined as being at zero when the vector points right along the positive x direction, and positive angle changes are defined as being in the anticlockwise direction. This could be the source of your problem, if you are assuming that zero degrees points upwards, and positive is clockwise (as I think Direct3D sprites are defined). You may have to convert between the two conventions when using trig functions.   ;  Also make sure it's not something obvious like GetRotation returning degrees but cos/sin taking radians.   ;  Oh that must be it! Forgot to mention I was using direct3d, thought this was a math problem not an application one. Thanks!   