# Rotate to collision normal and towards target object axis

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!

for any other newbies hitting this sort of barrier the correct thing to do is just to multiply the Quaternions, so…

``````var quatHit = Quaternion.FromToRotation(Vector3.up , hit.normal);
var quatForward = Quaternion.FromToRotation(Vector3.forward, targetObject.transform.forward);
var quatC = quatHit * quatForward;
transform.rotation = quatC;
``````

simple when you know how, of course…