Hi, I develope an AR-Application where the real time acceleration of my data source (vehicle) should be visualized in a circle around the Center Field of View like the following picture shows:
Therefore I receive a speed value via UDP. The value is beeing updated every 10 MS (in the code this value is called reloadSpeed).
With this dynamic speed value I calculate the acceleration in the following way.
acceleration = (speedValue - lastSpeedValue) / (reloadSpeed/1000.0d);
In another script I wrote a Coroutine which should move the two dots up and down around the circle depending on the calculated value of my acceleration. Here you can see the coroutine:
IEnumerator alignAccDots()
{
float referenceValue = 90.0f / maxAcceleration;
acceleratation = acceleratation * (referenceValue * Mathf.Deg2Rad);
rightAccelerationDot.transform.localPosition = new Vector3(Mathf.Cos(acceleratation) * 85.0f, Mathf.Sin(acceleratation) * 85.0f, 0.0f);
leftAccelerationDot.transform.localPosition = new Vector3(-Mathf.Cos(acceleratation) * 85.0f, Mathf.Sin(acceleratation) * 85.0f, 0.0f);
yield return new WaitForSeconds(reloadSpeed/1000);
}
The only problem is, that the acceleration dots jump around crazy in their Position and don´t move in a fluent way as they should. I was wondering if the reason for my Problem is the render time of each Frame, which is around 7 MS but I can´t believe that this is the reason. If it is, is there a way to work around this Problem?
I´d really appreciate some help.