I’d like to rotate an object along its local y axis based on the user’s dragged input. I’ve just spent about 6-8 hours trying to figure it out, but to no avail. I’ve love some pointers.
Here’s a bit of what I’ve tried so far:
Using a method similar to the tutorial about rotating an object with the mouse
My first thought was to use the approach listed here. The problem with this is that since it’s pretty much mapping directly from mouse/touch dx/dy, it doesn’t translate into local space (at least not that I could figure out. For example, what if I’m at an odd angle to the object, and I want to rotate it around the y axis?
Using a method similar to a previous forum post about dragging an object (translation) in 3D space
This doesn’t really work, at least from what I could figure out, because whereas for translation I can project along the object’s axis to get the distance, rotation doesn’t work the same. That is, dragging in a straight line along the x axis can kind of be used to calculate rotation if the camera is facing the object from the front , slightly above the ground. But what if the camera is above the object facing down? Then, to rotate the object around it’s y axis, the user shouldn’t need to drag in a straight line along the x axis. Rather, they’d expect to drag the object around in a circle.
I tried several other similar methods too, but nothing worth mentioning really.