Add wheel friction when inside the track

This commit is contained in:
duarteapcoelho 2022-09-11 11:49:17 +01:00
parent cf62bb7f87
commit 9862fefced

View file

@ -28,7 +28,9 @@ void Car::processInput(){
}
void Car::update(bool isOnTrack){
if(!isOnTrack)
if(isOnTrack)
wheelSpeed = wheelSpeed * (1.0f / (1.0f + (Time::delta * 0.001f)));
else
wheelSpeed = wheelSpeed * (1.0f / (1.0f + (Time::delta * 0.002f)));
speed.x = speed.x + wheelSpeed * float(fp_cos(fp(direction))) * Time::delta / 150.0f;
speed.z = speed.z + wheelSpeed * float(fp_sin(fp(-direction))) * Time::delta / 150.0f;