Paras Mittal
Paras Mittal

Reputation: 1149

body.getTransform().setRotation(value) not working in box2d

Hi i want to set rotation of body without changing its position. I came across a function of body.

 body.getTransform().setRotation();

But this function doesn't seems to work.

Am i doing something wrong . I know i can do it with

body.setTransform(x, y, angle);

but then i have to pass its position also and i don't want to do that.

Is there any other way I can only change the body angle.

Upvotes: 1

Views: 436

Answers (1)

iforce2d
iforce2d

Reputation: 8262

You can just give the existing position and angle to setTransform, if you don't want them to change. For example, this will have no effect:

body->SetTransform( body->GetTransform(), body->GetAngle() );

Upvotes: 1

Related Questions