- Home /
How to smooth my Rotation?
Hey Guys! When im holding a Button my 2D Character will rotate in the left direction, but how can i smooth that rotation? Here is the script:
if (rotateLeft && CanMove == true && isFalling == true) { transform.Rotate(new Vector3(0, 0, 1 Time.deltaTime RotationStrenght)); }
It depends on whether you want to rotate to a certain degree or as long as key pressed. So what do you want to do exactly?
Answer by francomarini1982 · Apr 14, 2019 at 01:25 PM
if (rotateLeft && CanMove == true && isFalling == true) { transform.Rotate(new Vector3(0, 0, 1 Time.deltaTime RotationStrenght)); }
This will compile with a lot of errors.
1- Vector 3 has only 3 parameters
2- What is that 3rd parameter????????? = "1 Time.deltaTime RotationStrenght"
3- Time.deltatime and RotationStrenght should multiply de vector3
i think that you want its this:
transform.Rotate(new Vector3(0, 0, 1) * Time.deltaTime * RotationStrenght);
if you want to go clockwise:
transform.Rotate(new Vector3(0, 0, -1) * Time.deltaTime * RotationStrenght);
$$anonymous$$y code is working fine I don't get any errors. I just want to smooth my rotation when i hold a button.
Your answer
Follow this Question
Related Questions
How can i make a boat transport? 1 Answer
Shade Object Flat 1 Answer
Move and rotate the camera at the same time 2 Answers
Smooth Camera Movement script with problem. 0 Answers
Aligning a rigidbody smoothly with the perpendicular of a vector angle 0 Answers