- Home /
Question by
dupan · Aug 27, 2015 at 12:20 PM ·
rotationquaterniontransform.rotation
How to combine multiple rotations at once?
I have a sword, that I am rotating by transform. It mainly rotates only on X and Y axis (sometimes Z). It rotates to mouse position in space. Now I want this sword to rotate blade in direction that I want. That is the code I am using. _myTransform is sword transform, mouseObject is helper object that follows mouse in space.
Quaternion rotation = Quaternion.LookRotation(mouseObject.position - _myTransform.position);
_myTransform.rotation = Quaternion.Slerp(_myTransform.rotation, rotation, Time.deltaTime * newDamping);
Question is: How to combine that with independent Z rotation?
Comment