Hey hey, I need a spinning player when he enters a specific area of the map.
I use this code when the player enters the area:
So my player rotates - awesome.
Now when he leaves the area where he is to rotate, I want him to stop rotating - so I do :
However what happens is he continues to try to rotate then snaps back to the correct rotation, then tries to rotate again, then snaps back to upright, again and again and again and again!
Help! How can I stop the applytorque force acting upon the body!
I use this code when the player enters the area:
Code:
public void rotatePlayer(){
s.body.setFixedRotation(false);
s.body.applyTorque(16);
}
s.body.setFixedRotation(false);
s.body.applyTorque(16);
}
So my player rotates - awesome.
Now when he leaves the area where he is to rotate, I want him to stop rotating - so I do :
Code:
public void returnToNormal() {
s.body.setTransform(s.body.getPosition(), 0f);
s.body.setFixedRotation(true);
}
s.body.setTransform(s.body.getPosition(), 0f);
s.body.setFixedRotation(true);
}
However what happens is he continues to try to rotate then snaps back to the correct rotation, then tries to rotate again, then snaps back to upright, again and again and again and again!
Help! How can I stop the applytorque force acting upon the body!