Hi,
How can i do to force the rotation angle of a b2LineJoint so it always steps of 1 degree only. eg. 0, 1, 2, 3 .. 90.. 180...
Not 0.16, 2.56, ... 90,23 degrees....
Im using a b2MouseJoint to control an arrow that can rotate and slide, but need the rotation angles to be steps of 1 deg only.
On the mouseMove event i tried to convert the body angle to degress and then round it and then convert it again to radians, but the body
behaves completelly abnormally if i try the following:
Anyone know what im doing wrong ?
Thank You ALL !
How can i do to force the rotation angle of a b2LineJoint so it always steps of 1 degree only. eg. 0, 1, 2, 3 .. 90.. 180...
Not 0.16, 2.56, ... 90,23 degrees....
Im using a b2MouseJoint to control an arrow that can rotate and slide, but need the rotation angles to be steps of 1 deg only.
On the mouseMove event i tried to convert the body angle to degress and then round it and then convert it again to radians, but the body
behaves completelly abnormally if i try the following:
Code:
float32 angle =CC_DEGREES_TO_RADIANS(round(CC_RADIANS_TO_DEGREES(arrowBody->GetAngle())));
arrowBody->SetTransform(arrowBody->GetWorldCenter(),angle);
arrowBody->SetTransform(arrowBody->GetWorldCenter(),angle);
Anyone know what im doing wrong ?
Thank You ALL !