Accumulate rotation around the mouse

HI im trying to make a game where you charge your weapon on rotating it around the player. Its a top down game and I just can’t figure out how to check how much it was spinned. I would like to spin it with the cursor and I can do that know with using transform.up. Is there any way so i can measure the rotation and keep the value of it while its still happening and when it stops it nulls the whole thing?

Enclosed is a “spin by touch” package… it just takes a series of offsets from center to wherever your finger is and computes the total angular movement.

For your use you would take the per-frame angle and as long as it is above a certain amount, keep charging, otherwise reset it to zero, or bring it rapidly towards zero.

9648056–1372379–RotateZViaDrag.unitypackage (20.1 KB)

Thank you so much this helped a lot!

1 Like