Continue ghost

This commit is contained in:
Miloslav Ciz 2025-01-22 21:39:14 +01:00
parent dc66182afb
commit bcf692d471
3 changed files with 93 additions and 102 deletions

View file

@ -1295,34 +1295,34 @@ uint32_t LCR_racingStep(unsigned int input)
LCR_racing.carBody.joints[i].velocity[2] = jv.z;
}
driftFriction /= 4;
driftFriction /= 4;
if ((!LCR_racing.carDrifting) &&
driftFriction > LCR_CAR_DRIFT_THRESHOLD_1)
{
LCR_LOG1("drift start");
LCR_racing.carDrifting = 1;
}
else if (LCR_racing.carDrifting &&
driftFriction < LCR_CAR_DRIFT_THRESHOLD_0)
{
LCR_LOG1("drift end");
LCR_racing.carDrifting = 0;
}
if ((!LCR_racing.carDrifting) &&
driftFriction > LCR_CAR_DRIFT_THRESHOLD_1)
{
LCR_LOG1("drift start");
LCR_racing.carDrifting = 1;
}
else if (LCR_racing.carDrifting &&
driftFriction < LCR_CAR_DRIFT_THRESHOLD_0)
{
LCR_LOG1("drift end");
LCR_racing.carDrifting = 0;
}
/* The following fixes "sticking to a wall" issue by adding a small spin
to the car when trying to steer at very small velocity. */
if (steering &&
(input & (LCR_RACING_INPUT_FORW | LCR_RACING_INPUT_BACK)) &&
(LCR_racing.wheelCollisions & 0x0f) &&
LCR_racingGetCarSpeedUnsigned() < (LCR_GAME_UNIT / 25))
{
LCR_LOG2("spinning car a bit");
/* The following fixes "sticking to a wall" issue by adding a small spin
to the car when trying to steer at very small velocity. */
if (steering &&
(input & (LCR_RACING_INPUT_FORW | LCR_RACING_INPUT_BACK)) &&
(LCR_racing.wheelCollisions & 0x0f) &&
LCR_racingGetCarSpeedUnsigned() < (LCR_GAME_UNIT / 25))
{
LCR_LOG2("spinning car a bit");
TPE_bodySpin(&LCR_racing.carBody,TPE_vec3(0,
steering == ((input & LCR_RACING_INPUT_LEFT) != 0) ?
TPE_F / 32 : -1 * TPE_F / 32,0));
}
TPE_bodySpin(&LCR_racing.carBody,TPE_vec3(0,
steering == ((input & LCR_RACING_INPUT_LEFT) != 0) ?
TPE_F / 32 : -1 * TPE_F / 32,0));
}
}
if ((!(input & LCR_RACING_INPUT_LEFT)) &&