Fix bug and mod physics

This commit is contained in:
Miloslav Ciz 2025-04-15 15:04:19 +02:00
parent 00519e0116
commit 5c14eb6f45
2 changed files with 6 additions and 33 deletions

4
data
View file

@ -96,5 +96,5 @@ details
:]h0gI :}g0gI :|g1gI :f211 :|g3gI- :f211 :]g4gI- :f211 :;g0fJ :f251
:-e5g :f413 :|g0hL
:+018 :f213 :!v05 :f311
#RLC4;00LC4;bcf27d79 0000738:0011:00f9:00a1:0049:00a1:0069:0031:0063:0051:0059:0031:01a9:0041:0073:0041:00f9:0021:0215:0031:0049:0091:0023:0081:0053:0061:0089:0041:0073:0021:0079:00d1:0079:0051:0059:0021:0889:0091:0059:0031:0029:00b1:0169:0011:0143:0061:00a9:0061:0059:0051:00b3:0041:01d9:0021:0079:0061:00b9:00a1:0039:0031:0039:0021:0013:0081:0019:00d1:00f9:0081:0049:0031:0043:0051:0103:0061:00b3:0031:0193:0021:0089:0011
#BLC4;
#RLC1;00LC1;8bd6e314 0000475:0011:0199:0041:00a9:0051:0029:0091:0049:0041:0049:0041:0249:0091:0015:0031:0019:01a1:0049:0041:0119:0031:0069:0041:0049:0041:0059:0031:00d9:0031:00f9:0021:0155:0041:01d3:0061:0113:00f1:0043:00c1:0083:0051:0203:0021:0513:0031
#RLC1;00LC1;8bd6e314 0000455:0011:0169:0041:00a9:0031:0049:00a1:0059:0051:0059:0031:01e9:0071:0045:0039:00e1:0019:00d1:0079:0041:0049:0021:0049:0031:0039:0031:0069:0071:0029:0041:00c3:0041:00e9:0021:0145:0041:0253:01b1:00b3:0051:00a9:0071:0073:0031:00a3:0021:03b3:0031:00a9:0021:0073:0021

View file

@ -310,6 +310,10 @@ int LCR_replayLoadFromStr(char (*nextChar)(void),
c = nextChar();
}
for (int i = LCR_racing.replay.eventCount; // must be here
i < LCR_SETTING_REPLAY_MAX_SIZE; ++i)
LCR_racing.replay.events[i] = 0;
return 1;
}
@ -1495,37 +1499,6 @@ uint32_t LCR_racingStep(unsigned int input)
}
}
// now make a special test for a "pinch" front collision
TPE_Vec3 frontWheelMiddle = TPE_vec3Plus(
LCR_racing.carBody.joints[0].position,
LCR_racing.carBody.joints[1].position);
frontWheelMiddle.x /= 2;
frontWheelMiddle.y /= 2;
frontWheelMiddle.z /= 2;
frontWheelMiddle = TPE_vec3Minus(frontWheelMiddle,
_LCR_racingEnvironmentFunction(frontWheelMiddle,LCR_PHYSICS_UNIT / 4));
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;
if (frontCollision)
{
// stop the front wheels
LCR_LOG1("car front pierced");
for (uint8_t i = 0; i < 3; ++i)
{
LCR_racing.carBody.joints[0].velocity[i] = 0;
LCR_racing.carBody.joints[1].velocity[i] = 0;
}
}
int carBlock[3];
LCR_racingGetCarBlockCoords(carBlock);