Fix physics even more

This commit is contained in:
Miloslav Ciz 2025-04-23 17:11:47 +02:00
parent 0e694589eb
commit c22f17ef8c
3 changed files with 22 additions and 12 deletions

View file

@ -1,7 +1,5 @@
=========== GENERAL ==============
- when non-rotating, the car is very fast, allowing uberbugs: find out why and
fix
- fix the ramp map again due to new physics
- should drifting make a sound?
- keyboard ghosting is an issue, particularly when initiating drift with brake
@ -81,6 +79,8 @@
=========== HANDLED ==============
- MAP4: one triangle in top section is missing!
- when non-rotating, the car is very fast, allowing uberbugs: find out why and
fix
- allow slowing down in air like in TM?
- some kinda easteregg in menu or smt
- make the racing module usable by itself, e.g. to allow making tools for

5
data
View file

@ -146,3 +146,8 @@ details
#RLCtiny4;00LCtiny4;1787f12a 0000184:0011:00c9:0071:0133:0051:0073:00e1:0033:00f1:0053:00a1:0063:0071:0123:0041
#RLCtiny1;00LCtiny1;7e39e006 0000347:0011:0319:0031:0169:0041:0159:00b1:01e3:0071:0073:0021:0043:0051:0095:0033:01a1:0073:0031:0063:0031:0363:0161:00f3:0091:0089:0031
#BLCtiny1;
#RLC3;00LC3;cb1b38e6 0000589:0011:0099:0041:0083:0031:0049:0031:00c0:0024:01a5:0021:00c9:0051:00d3:00a1:0093:0051:02b3:0031:0073:0011:0023:00a1:0109:01d1:00b3:0021:0059:00c8:0039:0021:0019:0018:0049:0031:0053:0061:0089:0031:0023:00b1:0039:0041:00d3:0031:0073:0081:00b3:0041:00e9:0011:0053:0071:0103:00c1:00e5:0041:00b9:0091:0063:0081:0103:0011:0363:0031:0083:0071:0053:0081
#RLCbonus2;00LCbonus2;288d28fe 0001119:0011:0089:0061:0023:0101:0053:0081:0023:00a1:0220:0038:001c:0084:003c:00a0:0031:0013:00d2:004c:0090:0061:0013:0051:0050:0048:0031:0040:0101:0019:0051:00a3:0031:00f5:0041:0040:0042:002a:0012:0010:0062:0040:0048:0020:0032:0016:0052:0010:0049:0090:0052:0030:0014:002c:0070:0061:00a0:0022:00cc:0058:0020:0061:0043:0101:00b0:0022:0021:0013:0021:0023:0061:00a3:0091:0110:0031:0010:0032:0013:0042:0033:0042:013c:0094:0040:0083:0091:00c0:00e1:0143:0041:0049:0061:0033:0091:0039:0061:0133:00d1:0049:0111:0063:0071:0018:0109:0058:0089:0048:0030:0061:0053:00c1:0033:0042:0050:0022:0010:0011:00e2:0043:0011:0060:0052:0036:00f0:0018:0029:00c8:0160:00c8:0091:0050:00c1:0029:0060:0054:0158:0089:0068:0049:0028:0059:0031:0083:0121:0059:00c1:0073:0041:0039:0038:0119:0078:0089:0091:0063:0051:0253:0041:0060:0052:0053:0072:0063:0031:0073:0022:0133
#BLCbonus2;
#RLCtiny2;00LCtiny2;833ee4b2 0000262:0014:0a10:0031:00d0:0074
#RLCtiny4;00LCtiny4;1787f12a 0000233:0121:0083:0091:0073:0061:0043:0031:0033:0041:0033:0061:00a3:0142:01b1:0129:0061:0159:0031:00f9:0051

View file

@ -1450,14 +1450,22 @@ uint32_t LCR_racingStep(unsigned int input)
TPE_Joint joints[LCR_CAR_JOINTS];
if (!_LCR_racingCarShapeOK())
printf("NOT OOOOOOOOOOOK\n");
TPE_Vec3 linearVel = TPE_bodyGetLinearVelocity(&LCR_racing.carBody);
/* Now back up the joints and also set all current joint velocities to the
average linear velocity (since non-rotating bodies only consider the
first joint's velocity, it must be the average of the whole body, else
the car is super fast): */
for (int i = 0; i < LCR_CAR_JOINTS; ++i)
{
joints[i] = LCR_racing.carBody.joints[i];
LCR_racing.carBody.joints[i].velocity[0] = linearVel.x;
LCR_racing.carBody.joints[i].velocity[1] = linearVel.y;
LCR_racing.carBody.joints[i].velocity[2] = linearVel.z;
}
LCR_racing.carBody.flags |= TPE_BODY_FLAG_NONROTATING;
for (int i = 0; i < LCR_CAR_JOINTS; ++i)
joints[i] = LCR_racing.carBody.joints[i];
TPE_worldStep(&(LCR_racing.physicsWorld)); // non-rotating step
for (int i = 0; i < LCR_CAR_JOINTS; ++i) // remember the position and reset
@ -1484,14 +1492,11 @@ if (!_LCR_racingCarShapeOK())
if ((LCR_racing.carBody.flags & TPE_BODY_FLAG_UNRESOLVED) ||
!_LCR_racingCarShapeOK())
{
printf("SASASASSASASASASASASSAS\n");
TPE_bodyStop(&LCR_racing.carBody);
for (int k = 0; k < 2 * TPE_RESHAPE_ITERATIONS; ++k)
TPE_bodyReshape(&LCR_racing.carBody,_LCR_racingEnvironmentFunction);
for (int k = 0; k < 2 * TPE_RESHAPE_ITERATIONS; ++k)
TPE_bodyReshape(&LCR_racing.carBody,_LCR_racingEnvironmentFunction);
}
}
}