- Home /
transform.eulerAngles rotating speed (quick question)
Quite simply:
Is it possible to apply a 'rotate speed' variable to a transform.eulerAngles? I've tried it, but the speed doesn't seem to change no matter how low i set the rotateSpeed variable.
var rotateSpeed : float = 0.1; //i've tried MUCH lower than this too!
if(Input.GetButton("turn"))
{
transform.eulerAngles = Vector3(90, 0, 0) * rotateSpeed * Time.deltaTime;
}
Thanks, Tom :)
Answer by Bunny83 · Jul 18, 2012 at 02:55 PM
This doesn't assign a "rotate speed" to the object. This just sets an absolute rotation. You should use Transform.Rotate.
transform.Rotate(Vector3(90, 0, 0) * rotateSpeed * Time.deltaTime);
or
transform.Rotate(90 * rotateSpeed * Time.deltaTime, 0, 0);
Hah! You're right, and i should have noticed that :)
Thing is, i was using eulerAngles because it gives me a TOTAL rotation (it EQUALED 90 degrees rather than INCRE$$anonymous$$ENTING by 90 degrees).
Is there a preset rotation that will let me rotate TO 90 degrees and be able to adjust the speed? Even a 'Unity Script Reference' link would be fine.
If there's not, i'll try messing with a '$$anonymous$$athf', but i'd rather not.
Thanks again for your help, $$anonymous$$ :)
Your answer
Follow this Question
Related Questions
Set a relative (custom) speed to a rotation 1 Answer
Why Local Rotation Faster than World Rotation (Degrees/Second) 1 Answer
Rotation Jumping values (0 to 180) 1 Answer
Problem in Euler angles 2 Answers
GameObject Rotation is always postive 0 Answers