Question by
Liam_B · Apr 03, 2017 at 02:56 PM ·
rotationtransformquaternion
Transform.Rotate with dynamic values
Hello!
For declaring the initial rotation on objects I'm able to do;
Model.transform.localRotation = Quaternion.Euler (mARData.RotationX, mARData.RotationY, mARData.RotationZ);
But I'm trying to use something like
transform.Rotate(Vector3.up, speed * Time.deltaTime);
Yet using those "mARData.RotationX/Y/Z" values instead of Vector3.Up
However I'm a little stuck, any suggestions would be greatly appreciated
Comment
Best Answer
Answer by Namey5 · Apr 04, 2017 at 06:23 AM
Try using;
transform.Rotate (Quaternion.Euler (mARData.RotationX, mARData.RotationY, mARData.RotationZ) * Vector3.forward, speed * Time.deltaTime);
This basically takes the Quaternion you used in the first instance and 'converts it' into a Vector3, which you can then use in the Rotate () function.