Tune front collision check

This commit is contained in:
Miloslav Ciz 2024-12-06 01:04:05 +01:00
parent 2a7ae5278e
commit 46efd97130
2 changed files with 10 additions and 2 deletions

View file

@ -24,6 +24,8 @@ static const char *LCR_maps[] =
"#=s0B0 #fd910" // concrete wall "#=s0B0 #fd910" // concrete wall
"#^s1A0 #fk110" // ramps before wall "#^s1A0 #fk110" // ramps before wall
"#-s0q0"
"#;p0w0L #f5130" // bugs "#;p0w0L #f5130" // bugs
"#=f0s0 #fd110" // small labyrinth "#=f0s0 #fd110" // small labyrinth

View file

@ -913,14 +913,20 @@ if (TPE_vec3Dot(carVel,carForw) < 0)
frontWheelMiddle = TPE_vec3Minus(frontWheelMiddle, frontWheelMiddle = TPE_vec3Minus(frontWheelMiddle,
_LCR_racingEnvironmentFunction(frontWheelMiddle,LCR_PHYSICS_UNIT / 4)); _LCR_racingEnvironmentFunction(frontWheelMiddle,LCR_PHYSICS_UNIT / 4));
uint8_t frontCollision = frontWheelMiddle.x == 0 && frontWheelMiddle.y == 0 && uint8_t frontCollision =
carForw.y < TPE_FRACTIONS_PER_UNIT / 4 && // only when car is horizontal
carForw.y > -1 * TPE_FRACTIONS_PER_UNIT / 4 &&
frontWheelMiddle.x == 0 && frontWheelMiddle.y == 0 &&
frontWheelMiddle.z == 0; frontWheelMiddle.z == 0;
if (frontCollision) if (frontCollision)
{ {
// stop the car immediately // stop the car immediately
LCR_LOG1("car front pierced"); LCR_LOG1("car front pierced");
LCR_racing.carNotOKCount += (LCR_racing.carNotOKCount < 15 ? 32 : 0); // TODO: consts
LCR_racing.carNotOKCount +=
//(LCR_racing.carNotOKCount < 15 ? 32 : 0); // TODO: consts
(LCR_racing.carNotOKCount < 20 ? 15 : 0); // TODO: consts
} }
if ((LCR_racing.carBody.flags & TPE_BODY_FLAG_UNRESOLVED) || frontCollision || if ((LCR_racing.carBody.flags & TPE_BODY_FLAG_UNRESOLVED) || frontCollision ||