hi to everyone here I'm new of the forum.
I'm stuck with a really simple problem.
I want to convert local vectors in world space.
i tried
direction = body->GetWorldVector(b2Vec2(0,1));
direction.Normalize();
to get my object y axis in world coordinates.
It seems to give me a vector that rotates much faster than the real object.
I expected to have the same result as this code.
float radians = body->GetAngle()* PI/180;
direction.y= cosf(radians);
direction.x= -sinf(radians);
that probably does quite the same in practice but give me the correct result.
Having to use it for many other vectors how can i do?
As i would prefere to use GetWorldVector instead of arctan every time to convert local vector to angle and rotate 0,1 vector to that angle to have the world vector.
I'm stuck with a really simple problem.
I want to convert local vectors in world space.
i tried
direction = body->GetWorldVector(b2Vec2(0,1));
direction.Normalize();
to get my object y axis in world coordinates.
It seems to give me a vector that rotates much faster than the real object.
I expected to have the same result as this code.
float radians = body->GetAngle()* PI/180;
direction.y= cosf(radians);
direction.x= -sinf(radians);
that probably does quite the same in practice but give me the correct result.
Having to use it for many other vectors how can i do?
As i would prefere to use GetWorldVector instead of arctan every time to convert local vector to angle and rotate 0,1 vector to that angle to have the world vector.