Hi all,
I’m not a programmer, I just have few 3D modelling skils, so please be patient with me. ![]()
I’m modelling a dashboard in unity for a driving simulator. Everything is working fine, but what’s missing is a smooth rotation of the pointers (RPM and Speed). Actually they’re moving very harshly at a frequency of 200Hz.
Here’s the code:
//Calculating rotations
//RPM pointer (linear)
if ((float)data.vicrt_rpm <= 8000f)
{
RPM_rot = (float)data.vicrt_rpm * 259f / 8000f;
}
else
{
RPM_rot = 259f;
}
//Speed pointer (non linear)
if ((float)data.vicrt_vel <= 0f)
{
speed_rot = 0f;
}
else if ((float)data.vicrt_vel >0f && (float)data.vicrt_vel <= 100f)
{
speed_rot = (float)data.vicrt_vel * (130.5f/100f);
}
else if ((float)data.vicrt_vel >100f && (float)data.vicrt_vel <= 180f)
{
speed_rot = 130.5f + ((float)data.vicrt_vel - 100f) * ((196f-130.5f)/(180f-100f));
}
else if ((float)data.vicrt_vel >180f && (float)data.vicrt_vel < 300f)
{
speed_rot = 196f + ((float)data.vicrt_vel - 180f) * ((261f-196f)/(300f-180f));
}
if ((float)data.vicrt_vel >= 300f)
{
speed_rot = 261f;
}
//Applying rotations
RPM_gauge.transform.eulerAngles = new Vector3 (270, 180, RPM_rot);
Speed_gauge.transform.eulerAngles = new Vector3 (270, 180, speed_rot);
What I need is to introduce some smoothing/damping in order to create a more realitic movement of the pointers.
I tried to use lerp, mathf, etc but with no results. Unfortunately I’ve almost zero skills with c# so that’s why maybe I wasn’t able to let them run.
Anyway, here’s a picture of the dashboard.

I’ll be grateful to whom will try to help me!