Answers for "Copy Rotation in script C#"
http://answers.unity.com/questions/1284595/copy-rotation-in-script-c.html
The latest answers for the question "Copy Rotation in script C#"Answer by brunocoimbra
http://answers.unity.com/answers/1284642/view.html
To achieve something like that with rotation:
public void CopyPosition(GameObject Target, Vector3 Offset = default(Vector3))
{
transform.position = Offset + Target.transform.localPosition;
}
You can do that:
public void CopyRotation(GameObject Target, Vector3 Offset = default(Vector3))
{
transform.rotation = Quaternion.Euler(Offset) * Target.transform.localRotation;
}
Quaternion.Euler transform the given euler angles (andles in X, Y, and Z) into a Quaternion rotation.
Also, to "add" 2 Quaternions you should use the "* (multiply)" operator.Tue, 13 Dec 2016 02:52:03 GMTbrunocoimbra