Question by
Pilistice · Mar 04, 2020 at 05:26 PM ·
rotationquaternionlerpacceleration
Object rotation lerp with acceleration
Hi,
I have a character walking and I would like the character to turn smoothly faster and faster to the right when I press the right arrow until it reach a maximum angular speed.
But the angular speed stays constant.
float AngularSpeed = 0.1f;
float increment;
void Update()
{
if(Input.GetKey("right"))
{
transform.rotation = Quaternion.Slerp(transform.rotation, Quaternion.Euler(0, 30+increment, 0), Time.time * AngularSpeed);
increment += 70f * Time.deltaTime;
}
}
Does anyone have an idea ?
Comment
Your answer
Follow this Question
Related Questions
How to smoothly rotate gameobject 20 degrees on key press? 0 Answers
fromtorotation inacurate Help fixing? 0 Answers
Smooth Rotation Quaternion Lerp? 1 Answer
Rotation (Quaternion.Lerp) not working 0 Answers
Is it possible to rotate an object around its z-axis without changing its x-axis and y-axis? 1 Answer