I’m trying to find out the amount of full rotations (spins) in the x axis my object is doing. So far i have…
if(m_bGetRotOnce)
{
m_fGetStartXRotation = gGlobals.GetCurrentObject().transform.localEulerAngles.x;
m_fGetCurXRotation = 0;
m_bGetRotOnce = false;
}
float localX = gGlobals.GetCurrentObject().transform.rotation.x;
m_fGetCurXRotation += localX - m_fGetStartXRotation;
if(m_fGetCurXRotation >= 360)
{
m_sNumberOfFlips++;
m_fGetCurXRotation = 0;
}
This counts m_sNumberOfFlips too often, i can see how it’s going wrong, but i was wondering if anyone had a solution to this.
Thanks.