Question by
IronBeagle_6 · Sep 10, 2015 at 10:41 PM ·
axisrotation axiseuler angles
Add +1 each time a sphere turns 1 degree on it's axis
In this game of mine, a character is running on a big sphere which represents the world, but he doesn't move, the world does.
Well I want to count the distance he travels. 1 meters equals 1 degree on my sphere.
void Update()
{
transform.Rotate(new Vector3(0, 0, speed * TIme.deltaTime));
distanceTxt.text = meter.ToString("f0");
float rota = transform.eulerAngles.x;
if(rota % 1<=0.1f)
{
meter++;
}
}
Problem is, it is counting it too many times (3 degrees on the inspector, and meter = 169). Obviously since it's on Update. LateUpdate doesn't work. Neither fixed. Can't find a way to do it.
Any ideas ?
Comment