Here is the code im trying..
It turns, but not correctly. It also never turns in a full circle, it just kind of swings. The values of Body->GetAngle() range from 180 to -180. I think what i want is the values to range from 0 to 360?
Anyways, how is this usually done?
// Get mouse input for rotation b2Vec2 mousePoint = b2Vec2(sf::Mouse::getPosition().x, sf::Mouse::getPosition().y); float deltaX = mousePoint.x - Body->GetPosition().x; float deltaY = mousePoint.y - Body->GetPosition().y; float desiredAngle = (-180/3.1415927) * atan2f( -deltaX, deltaY); // Set Rotation Body->SetTransform( Body->GetPosition(), desiredAngle ); sprite.setRotation( Body->GetAngle()); std::cout<<Body->GetAngle()<<std::endl;
It turns, but not correctly. It also never turns in a full circle, it just kind of swings. The values of Body->GetAngle() range from 180 to -180. I think what i want is the values to range from 0 to 360?
Anyways, how is this usually done?