- Home /
w in Quaternion?
Hello,
-first of all what does the w do in Quaternions and what does it do to my x,y,z values?
-second I have ths line of code with this I want to turn an object 90°. but the w value fcks it up so do you know what value I best give to my w. or another function I can better use to turn my objects.
transform.rotation = new Quaternion(transform.rotation.x + rotationOfBlock.x, transform.rotation.y + rotationOfBlock.y, transform.rotation.z + rotationOfBlock.z, 1);
What values are stored in the "rotationOfBlock" variable? You are aware that a quaternion does not contain angles, but rather functions such as EulerAngles are used to perform conversions.
@Namey5 RotationOfBlock is a Vector3 with just an angle (in degree) to turn the block so I can easy change the amount of the block turns. and No i'm not aware of that. could you maybe write me a small line of code on how to change an angle by code?
Answer by Vice_Versa · Jun 04, 2017 at 06:39 AM
only a crazy person or mathematical genius would attempt to change the w value. convert it to Euler Angles that will give you a Vector 3 instead //assuming were rotating on the y axis transform.rotation = transform.rotation.eulerAngles + Quaternion.Euler(0,90,0);
Your answer
Follow this Question
Related Questions
When applying a 90 degree rotation to Euler Angles, it is over/undershooting sometimes.. 2 Answers
IMU Sensor and Quaternion 2 Answers
How do I rotate a game object in 45 degree steps per keystroke? 2 Answers
Top down camera for object moving on sphere 1 Answer
How do I rotate Z axis based off mouse click and drag? 2 Answers