I have two non-related transforms and wish to smoothly rotate one of them depending on the orientation of the other.
This can be done with the following code:
_transfA.rotation = Quaternion.Slerp(_transfA.rotation, _transfB.rotation, Time.deltaTime*0.01);
However, I now wish to only rotate so that transfA.up eventually reaches transfB.up
And I wish to do that without gimbal lock. That is, when the up direction points completely down, I don’t want the transformA to start spinning around that axis. I presume it therefore shouldn’t use euler angles, but rather some Quaternion trickery.
It’s for a game where I have a spherical planet, and need to orient camera relative to the surface, without the camera going crazy at the north and south pole of the planet.
How to do it?