I need to be able to take a texture of a arrow that is over my object and want to rotate it to the current heading direction of the object...
What functions can I call in Box2d to get this done? From what I have seen these maybe all I need but not sure.
I am not sure how to put them all together or if those are even what I need.
Thanks!!!
What functions can I call in Box2d to get this done? From what I have seen these maybe all I need but not sure.
Code:
b2Vec2 position = body->GetPosition();
float32 angle = body->GetAngle();
b2Vec2 dir = body->GetWorldVector(b2Vec2(0,1));
std::cout << "World Vector = " << atan2(dir.y, dir.x) << std::endl << std::endl;
b2Vec2 velocity = body->GetLinearVelocity();
std::cout << "Angle = " << atanf(velocity.y / velocity.x) + irr::core::HALF_PI;
float32 angle = body->GetAngle();
b2Vec2 dir = body->GetWorldVector(b2Vec2(0,1));
std::cout << "World Vector = " << atan2(dir.y, dir.x) << std::endl << std::endl;
b2Vec2 velocity = body->GetLinearVelocity();
std::cout << "Angle = " << atanf(velocity.y / velocity.x) + irr::core::HALF_PI;
I am not sure how to put them all together or if those are even what I need.
Thanks!!!