Hi folks,
Just starting out with unity, loving it so far but getting rotations to do what I want is killing me.
I have an object which I want to stand on a cylinder it collides with.
I can get the object to do this with a raycast and
transform.rotation = Quaternion.FromToRotation(Vector3.up, hit.normal);
but I also want it to face along the length of the cylinder. Now if I were to do
transform.rotation = Quaternion.FromToRotation(Vector3.forward, targetObject.transform.forward);
then that works on its own. However, it seems to me that I can’t do these one after the other as one just overides the other.
I’m guessing I should be able to do just one Rotation here to achieve what I want but it elludes me how to combine the two. I’m sure it’s a simple thing and I’ll go “oh right” when someone enlightens me… so please, for the love of my confused little brain, enlighten me!