Drag Object to Rotate on single axis

Hi I am Quite new to Needle Engine just want to ask on how I can implement a simple function.
Dragging the object to rotate (no position change just rotation on a single axis). thank you

Original Post on Discord

by user 311387970156625922

Hey :wave: When should the object be rotated? Only when the user is interacting with it or anywhere on the screen?

when the user click and drag the object itself not anywhere on the screen and as well as rotate it base on mouse position

by user 311387970156625922

To handle mouse events on objects: https://engine.needle.tools/docs/getting-started/for-unity-developers.html#inputsystem-callbacks

And then it is matter of saving the drag start position and calculating a delta from that very frame.

Similar to a Joystick logic: https://github.com/needle-tools/needle-engine-samples/blob/main/package/Runtime/FirstPersonController/Scripts/FirstPersonController~/UI%20Components/Joystick.ts

Let me know if you would get stuck or if anything wouldn’t be clear :cactus:

thnaks for this will try this out and will let you know my progress

by user 311387970156625922