- Home /
How to calculate delta offset time between race cars?
I have problems to calculate the telemetry data of relative intervals to the player.
The attached pic in the top right corner shows what I mean by delta offset / interval, idk what the right term is for this.
.
Imagine in this pic, all vehicles come to halt; the values remain the same, but in my calculation the deltas get astronomical values. That is, because the cars velocities are near 0. How does NFS Underground handle this?
My calculation:
//I call DeltaTimeToTarget(playerRb, opponentRb[i]) in forloop
public static float DeltaTimeToTarget(Rigidbody thisRb, Rigidbody comparingRb){
float dist = (thisRb.position - comparingRb.position).magnitude;
//thisRb.GetPointVelocity (comparingRb.position)
return dist / comparingRb.velocity.magnitude; //t = v * s
}
Comment
Your answer
![](https://koobas.hobune.stream/wayback/20220613014707im_/https://answers.unity.com/themes/thub/images/avi.jpg)