Comments and answers for "Setting value of transform.rotation in code, C#"
http://answers.unity.com/questions/604651/setting-value-of-transformrotation-in-code-c.html
The latest comments and answers for the question "Setting value of transform.rotation in code, C#"Answer by LukeNukem44
http://answers.unity.com/answers/1522708/view.html
Rotate your character naturally:
transform.Rotate(x, y, z); // Local
transform.Rotate(x, y, z, Space.World); // Global
In case you want to rotate to an absolute angle:
transform.rotation = Quaternion.Euler(x ,y ,z);
There's a lot more to research in the manual.Wed, 27 Jun 2018 12:30:31 GMTLukeNukem44Comment by LukeNukem44 on LukeNukem44's comment
http://answers.unity.com/comments/1522659/view.html
Um what? WTF
----------
In JS it's just
var temp = transform.rotation.eulerAngles;
temp.x = 90.0f;
transform.rotation = Quaternion.Euler(temp);
And you can write "var" in C#.
----------
Quaternion.Euler isn't a C# thing, it's a UNITY thing!Wed, 27 Jun 2018 10:35:57 GMTLukeNukem44Comment by yotoprules on yotoprules's answer
http://answers.unity.com/comments/988559/view.html
thank you!Wed, 17 Jun 2015 19:19:02 GMTyotoprulesComment by juicymangoz on juicymangoz's answer
http://answers.unity.com/comments/710284/view.html
Ech. This is why i hate C# sometimes. So over complicated for such a simple taskSun, 18 May 2014 23:40:41 GMTjuicymangozAnswer by KellyThomas
http://answers.unity.com/answers/604657/view.html
A `Transfom` will store rotation as a [`Quaternion`][1], great for 3D maths but bad for human brains.
One trick you can do is to convert to euler angles (similar to the rotation as displayed in the Inspector):
Vector3 temp = transform.rotation.eulerAngles;
temp.x = 90.0f;
transform.rotation = Quaternion.Euler(temp);
[1]: http://docs.unity3d.com/Documentation/ScriptReference/Quaternion.htmlSat, 28 Dec 2013 17:25:34 GMTKellyThomas