Modify wheel collisions
This commit is contained in:
parent
d794784bab
commit
e43ed793a3
3 changed files with 28 additions and 22 deletions
20
TODO.txt
20
TODO.txt
|
@ -12,20 +12,29 @@
|
|||
- maps to make:
|
||||
- there should be these maps:
|
||||
- compiled in:
|
||||
- standard maps, let's say 10?
|
||||
- standard maps, let's say 5?
|
||||
- additionally a few (5?) extremely simple maps, compile time option to
|
||||
only include these, for very weak devices with limited block/triangle
|
||||
count
|
||||
- bonus maps in the external file
|
||||
- bonus maps in the external file (also 5?)
|
||||
- map types:
|
||||
- traveling salesman kind of maze
|
||||
- traveling salesman kind of maze, with fans n shit
|
||||
- city map?
|
||||
- some kinda buggy bumpy downhill
|
||||
- dirt map
|
||||
- ice map
|
||||
- boss map
|
||||
- text or picture from blocks?
|
||||
- chessboard from different materials
|
||||
- falling tube map?
|
||||
- grass hills as decoration?
|
||||
- something with multiple roads
|
||||
- RPG kinda map? could be in bonus maps
|
||||
- some speed map
|
||||
- some speed map (mostly flat to prevent high speed bugs)
|
||||
- some (at least partially) interior map
|
||||
- something with multiple finishes
|
||||
- U-ramp to build speed and jump up to catch a CP
|
||||
- U-ramp to build speed and jump up to catch a CP (done)
|
||||
- jump through air ring with CP
|
||||
- try to speed up the slow culling
|
||||
- make a small txt game menual
|
||||
- test:
|
||||
|
@ -46,6 +55,7 @@
|
|||
|
||||
=========== BUGS =================
|
||||
|
||||
- immediately after starting the map countdown seems to be lower
|
||||
- the pinch collision test seems to sometimes stop the car e.g. after falling
|
||||
from bigger height or when running into ramp at high speed (or not?) - FIX
|
||||
|
||||
|
|
2
assets.h
2
assets.h
|
@ -94,7 +94,7 @@ static const char *LCR_internalDataFile =
|
|||
"#Rrep1;testmap;482f70f9 00000188:00c1:0089:0111:00b9:0091:0109:0028:0050:00c1:0093:0030:00d1:0069:0041:0020:0071:0013:0012:0023:0022:0050:0032:0020:0022:0060:0024:00bc:0044"
|
||||
|
||||
// MAP 1:
|
||||
"#MLicar1;4321 0 "
|
||||
"#MLC1;4321 0 "
|
||||
":*B2mL:!x6G:+L2H:+D38" // start, finish, CPs
|
||||
// pillars:
|
||||
":nw0w2L:f151:m151"
|
||||
|
|
28
racing.h
28
racing.h
|
@ -875,9 +875,9 @@ void _LCR_racingUpdateCarPosRot(void)
|
|||
LCR_racing.carPositions[0] = // smooth the position
|
||||
TPE_vec3KeepWithinBox(LCR_racing.carPositions[1],LCR_racing.carPositions[0],
|
||||
TPE_vec3(
|
||||
LCR_PHYSICS_UNIT / 64, // TODO: constant
|
||||
LCR_PHYSICS_UNIT / 64,
|
||||
LCR_PHYSICS_UNIT / 64));
|
||||
LCR_PHYSICS_UNIT / 128, // hardcoded consts
|
||||
LCR_PHYSICS_UNIT / 128,
|
||||
LCR_PHYSICS_UNIT / 128));
|
||||
|
||||
LCR_racing.carPositions[1] = tmpVec;
|
||||
|
||||
|
@ -1047,12 +1047,6 @@ void LCR_racingGetCarBlockCoords(int coords[3])
|
|||
(LCR_GAME_UNIT * LCR_MAP_SIZE_BLOCKS) / 2) / LCR_GAME_UNIT;
|
||||
}
|
||||
|
||||
int LCR_racingCarWheelTouchesGround(int wheel)
|
||||
{
|
||||
return ((LCR_racing.wheelCollisions & (LCR_racing.wheelCollisions >> 4))
|
||||
>> wheel) & 0x01;
|
||||
}
|
||||
|
||||
LCR_GameUnit LCR_racingGetWheelRotation(void)
|
||||
{
|
||||
return LCR_racing.wheelAngle;
|
||||
|
@ -1160,7 +1154,10 @@ uint32_t LCR_racingStep(unsigned int input)
|
|||
LCR_racing.carBody.joints[4].velocity[1],
|
||||
LCR_racing.carBody.joints[4].velocity[2]);
|
||||
|
||||
if ((LCR_racing.wheelCollisions & 0x0f) != 0x0f) // EXPERIMENTAL: don't apply gravity with all wheels on ground
|
||||
// apply gravity only if wheels are on the ground (prevents sliding a bit):
|
||||
|
||||
if (((LCR_racing.wheelCollisions | (LCR_racing.wheelCollisions >> 4))
|
||||
& 0x0f) != 0x0f)
|
||||
TPE_bodyApplyGravity(&(LCR_racing.carBody),LCR_GRAVITY);
|
||||
|
||||
if (LCR_racing.wheelCollisions) // at least one wheel on ground?
|
||||
|
@ -1229,8 +1226,7 @@ uint32_t LCR_racingStep(unsigned int input)
|
|||
{
|
||||
unsigned char steering = 0;
|
||||
|
||||
if ((input & LCR_RACING_INPUT_BACK) &&
|
||||
(LCR_racing.wheelCollisions & 0x0f) == 0x00) // in air?
|
||||
if ((input & LCR_RACING_INPUT_BACK) && LCR_racing.wheelCollisions == 0x00)
|
||||
{
|
||||
LCR_LOG2("air brake");
|
||||
|
||||
|
@ -1243,7 +1239,7 @@ uint32_t LCR_racingStep(unsigned int input)
|
|||
if (input & (LCR_RACING_INPUT_FORW | LCR_RACING_INPUT_BACK))
|
||||
{
|
||||
LCR_GameUnit rotateBy =
|
||||
(LCR_racing.wheelCollisions & 0x0f) ? // on ground slow down wheel rot.
|
||||
LCR_racing.wheelCollisions ? // on ground slow down wheel rot.
|
||||
(LCR_racingGetCarSpeedUnsigned() / LCR_CAR_WHEEL_GROUND_SPEED_DIV) :
|
||||
LCR_CAR_WHEEL_AIR_ROTATION_SPEED;
|
||||
|
||||
|
@ -1274,7 +1270,7 @@ uint32_t LCR_racingStep(unsigned int input)
|
|||
-1 * LCR_CAR_STEER_MAX);
|
||||
}
|
||||
|
||||
if ((LCR_racing.wheelCollisions & 0x0c)) // back wheel on ground?
|
||||
if ((LCR_racing.wheelCollisions & 0xcc)) // back wheel on ground?
|
||||
{
|
||||
if (input & LCR_RACING_INPUT_FORW)
|
||||
{
|
||||
|
@ -1291,7 +1287,7 @@ uint32_t LCR_racingStep(unsigned int input)
|
|||
TPE_Unit driftFriction = 0; // average wheel friction (absolute value)
|
||||
|
||||
for (int i = 0; i < 4; ++i)
|
||||
if (LCR_racing.wheelCollisions & (0x01 << i)) // wheel on ground?
|
||||
if (LCR_racing.wheelCollisions & (0x11 << i)) // wheel on ground?
|
||||
{
|
||||
TPE_Vec3 jv = TPE_vec3( // joint velocity
|
||||
LCR_racing.carBody.joints[i].velocity[0],
|
||||
|
@ -1346,7 +1342,7 @@ uint32_t LCR_racingStep(unsigned int input)
|
|||
|
||||
if (steering &&
|
||||
(input & (LCR_RACING_INPUT_FORW | LCR_RACING_INPUT_BACK)) &&
|
||||
(LCR_racing.wheelCollisions & 0x0f))
|
||||
(LCR_racing.wheelCollisions & 0x33))
|
||||
{
|
||||
/* When steering, also slightly spin the car. This helps fix the car
|
||||
getting "stuck" by its side to a wall when too close, becoming unable
|
||||
|
|
Loading…
Reference in a new issue