- Home /
Question by
novelgm99 · Sep 13, 2021 at 10:24 AM ·
rotationtransformtransform.rotation
how can i stop rotating gameobject but slowly
How can i make the plain propeller stop, slowly. I'm gonna give a force and propeller will spin as much as that force than it's gonna stop, slowly.
I did:
float adf = (Mathf.Abs(startPoint.x - endPoint.x)) + (Mathf.Abs(startPoint.y - endPoint.y));
rotZ += rotationSpeed * adf * Time.deltaTime;
transform.rotation = Quaternion.Euler(0, 0, rotZ);
But it's spins forever. I want to make it spin as "adf"
Comment
Answer by asafsitner · Sep 13, 2021 at 11:19 AM
Try replacing the += with just =
+= adds to rotZ, so even if it was greater than 0 for just a single frame, it will always be greater than 0, and will never stop.
= replaces the value in rotZ with whatever is after the sign, it can stop if you set it (or adf in your case) to 0
Your answer