As the title suggest, I have a body that I want to rotate manual depending on the direction of the sprite. I set fixedRotation to true so I don't have my sprite spinning around when it hits an object. But I am having trouble finding how to rotating a body manually? Any help is appreciated
How do we rotate a body manually in box2d?
(5 posts) (5 voices)-
Posted 1 year ago #
-
You can move and rotate a b2Body using "SetTransform"
float angle = 90.0 //or whatever you angle is b2Vec2 pos = body->GetPosition(); body->SetTransform(pos, angle);Posted 1 year ago # -
Also, you can use ApplyTorque and perhaps setAngularVelocity methods.
But please note, that neither of these methods will have any impact if the FixedRotation is set to true.
Regards,
QPosted 1 year ago # -
can you please give the example of angular velocity
Posted 1 year ago # -
b2Body eagleBody; .... //Bank Left eagleBody->ApplyAngularImpulse(1500); //Bank Right eagleBody->ApplyAngularImpulse(-1500);Posted 1 month ago #
Reply
You must log in to post.