BlindTerran / JayWalk_Processing

A 2D interactive game made with Java Processing library
MIT License
1 stars 0 forks source link

Incorrect vehicle minimum gap #10

Open BlindTerran opened 2 years ago

BlindTerran commented 2 years ago

The actual minimum gap between vehicles does not match the final variable MIN_GAP; the SRD also has the same issue. Using general velocity reduction algorithm instead of physics motion works fine for this.

BlindTerran commented 2 years ago

Since two vehicles are moving at different velocity, over time the actual SRD and the Minimum gap can have deviation. Try calculate SRD and minimum gap at run time

BlindTerran commented 2 years ago

Method 2 that modifies the general algorithm; known acceleration, the same formula calculate the SRD for a smoother result

BlindTerran commented 2 years ago

Instead of using distance traveled, predefined a variable delta time that vehicle takes to decelerate to replace SRD and use v.f-v.i / delta time to calculate acceleration