I’m trying to rotate an object on it’s z axis given an input angle in a circular fashion. Meaning that if I move my finger into a clockwise motion, the object should also rotate in that direction.
To sense rotating in a circle you need to define the center of the circle, and get the angle out to your finger. Then you take successive Mathf.Atan2() readings between the frames, and the difference is your rotation input.
Apparently the script you have above defines it as the center of the screen, assuming you say it requires full screen motion.
Instead, consider your center to wherever you want onscreen and sense the rotation from there. Also, you might want to make an overall bounds check rectangle so it doesn’t activate unless you’re close to that point initially.
Might be easiest to make a UI object with a visible center dot and a script that chases another dot around under your finger, so you can at least see what’s going on. There’s tons of UI tutorials for that sort of thing, then once you have that working, the delta X and delta Y between center and finger is your angle on any given frame.
Yeah that makes a ton of sense, basically just define a smaller circle onscreen and convert the input position to a screen position within those bounds. Yeah a small visual aid for debugging and implementing will be very helpful too. Thank you!