Language

Why is my transform.rotatearound reset only working on positive Y?

Hey there,

So I wanted to make a reset for my transform.rotatearound so that if someone moves the player, it will go back to a standstill. It was all well and good until I wanted to make it smooth rather than sudden. This is not necessary but is desired to make my game a little less... rough.
To make it smooth, rather than subtracting the Y-Rotation from the reset object rotation, I wanted to subtract 10% of the Y-Rotation from the reset object rotation. My logic is, for example 0 - (30 / 10) = -3 and that 0 - (-30 / 10) = 3 {Dus, adding on 30 to the -30 of the Y.)
Hopefully, that makes sense. To me, my logic makes sense and it should work for left and right. However, in reality, it only works when I am subtracting from a positive Y. The code is below, hopefully, someone can help shed light on my situation.
Thank you for your help in advanced - 1sd15.
using UnityEngine; using System.Collections;