I’m feeling dumb.
My desired effect is to rotate a sphere 45 degrees to the left, then 45 degrees to the right and then back to the original point in the middle. This rotation needs to be relative to the sphere itself, independent of world space.
So far all the solutions I’ve looked into involve assigning an object or point as the target for the rotation amount. Is there a clean way to accomplish this without a target?
If I’m just missing something super obvious somewhere, feel free to point me in that direction.
Thanks!
I would use quaternion multiplication to determine your target rotation. You will need to convert Euler angles to quaternion. Left and right need a frame of reference in 3r space, so pick an axis where your 45 degrees will apply. Here’s an example using the Z axis.
Then, presuming you want to do this smoothly over time, you will need some means to iteratively progress to your target. I would use a coroutine. With each iteration, you could have Quaternion.Slerp() or an easing function to enact the incremental rotation each Update().