How to Reverse Physics Object's Rotation

How can I reverse the rotation of a physics object on mouse-click? For example, if the player is rotating 30 degrees per second second clockwise, when the player clicks the mouse, the object’s rotation is then shifted to 30 degrees per second COUNTER-clockwise.
Thanks in advance.

Maybe you need a boolean variable called rotation dir
Then you’ll have to do the rotation based on your variable
Hint: You can rotate your object by many different methods

1 Like

the object is a physics object, and i’m not sure how to instantaneously change its rotation–the only options i see deal with adding torque. how can i achieve the rotation with the physics engine?

You can reverse rotation by multiplying the angular velocity by -1:

This reverses the rotation on every LMB click (ok, technically LMB release, but you know what I meant)

thanks for the response. the player character seems to rotate unnaturally on left-click.

to test why, i made a text object that displays the player’s AV (angular velocity)–no matter how many times i clicked, the AV of the player kept reverting back to negative. for example, if the player’s AV was -200 (counter-clockwise), and i clicked, the player would move clockwise for a half second and then return to rotating counter-clockwise. how can i fix this?

is there any way to get the player to immediately turn the opposite direction?

Have a look through the events. Are there any events that set it somewhere without a condition? The test I created didn’t exhibit this problem.

I think something like this works, where you change it to negative number of the same speed

1 Like

This will only change the direction once. The OP wants it every click.

Yes, as per my screen shot a few messages back. You’ll need to change angular dampening to 0, otherwise the spin will reduce over time.

1 Like

Oh, for every click. If that’s the case, then @MrMen’s method is fine. To turn player immediately,
Instead of this

Use this:

1 Like

Thanks to both of you. How do I access the “*=” symbol?

1 Like

got it figured out. appreciate the help MrMen + @Muzan

1 Like