Tune car params

This commit is contained in:
Miloslav Ciz 2024-12-06 00:18:06 +01:00
parent 93b622a0a4
commit e14a5184ce
3 changed files with 24 additions and 11 deletions

View file

@ -18,7 +18,7 @@
static const char *LCR_maps[] = static const char *LCR_maps[] =
{ {
"LM;;;0;#*s1s0" "LM;;;0;#*H1k0J"
"#=s0s0 #fd190" // big concrete "#=s0s0 #fd190" // big concrete
"#=s0B0 #fd910" // concrete wall "#=s0B0 #fd910" // concrete wall

View file

@ -21,8 +21,8 @@ typedef int32_t LCR_GameUnit; ///< abstract game unit
#define LCR_PHYSICS_UNIT 4096 ///< length of map square for physics engine #define LCR_PHYSICS_UNIT 4096 ///< length of map square for physics engine
#define TPE_RESHAPE_TENSION_LIMIT 10 #define TPE_RESHAPE_TENSION_LIMIT 3
#define TPE_RESHAPE_ITERATIONS 5 #define TPE_RESHAPE_ITERATIONS 8
#include "map.h" #include "map.h"
#include "tinyphysicsengine.h" #include "tinyphysicsengine.h"
@ -30,16 +30,15 @@ typedef int32_t LCR_GameUnit; ///< abstract game unit
// TODO: move some of this to constants? // TODO: move some of this to constants?
#define LCR_GRAVITY (LCR_PHYSICS_UNIT / 160) #define LCR_GRAVITY (LCR_PHYSICS_UNIT / 160)
#define LCR_CAR_FORWARD_FRICTION (TPE_F / 180) #define LCR_CAR_FORWARD_FRICTION (TPE_F / 180)
#define LCR_CAR_AIR_FRICTION 32 #define LCR_CAR_AIR_FRICTION 32
#define LCR_CAR_STAND_FRICTION_MULTIPLIER 32 #define LCR_CAR_STAND_FRICTION_MULTIPLIER 32
#define LCR_CAR_STEER_FRICTION (TPE_F) #define LCR_CAR_STEER_FRICTION (TPE_F)
#define LCR_CAR_ELASTICITY (TPE_F / 150) #define LCR_CAR_ELASTICITY (TPE_F / 150)
#define LCR_CAR_ACCELERATION (LCR_PHYSICS_UNIT / 20) #define LCR_CAR_ACCELERATION (LCR_PHYSICS_UNIT / 19)
#define LCR_CAR_STEER_SPEED (LCR_GAME_UNIT / 17)
#define LCR_CAR_STEER_SPEED (LCR_GAME_UNIT / 16) #define LCR_CAR_STEER_MAX (LCR_GAME_UNIT / 2)
#define LCR_CAR_STEER_MAX ((7 * LCR_GAME_UNIT) / 24)
// multipliers (in 8ths) of friction and acceleration on concrete: // multipliers (in 8ths) of friction and acceleration on concrete:
#define LCR_CAR_GRASS_FACTOR 5 #define LCR_CAR_GRASS_FACTOR 5
@ -637,6 +636,20 @@ uint32_t LCR_racingStep(unsigned int input)
{ {
LCR_LOG2("racing step start"); LCR_LOG2("racing step start");
/*
for (int i = 0; i < LCR_CAR_JOINTS; ++i)
printf(" %d: %d %d %d, %d %d %d\n",
i,LCR_racing.carBody.joints[i].position.x,
LCR_racing.carBody.joints[i].position.y,
LCR_racing.carBody.joints[i].position.z,
LCR_racing.carBody.joints[i].velocity[0],
LCR_racing.carBody.joints[i].velocity[1],
LCR_racing.carBody.joints[i].velocity[0]);
printf("------\n");
*/
uint32_t result = 0; uint32_t result = 0;
TPE_Vec3 carForw, carRight, carUp, carVel; TPE_Vec3 carForw, carRight, carUp, carVel;
uint8_t groundMat = LCR_BLOCK_MATERIAL_CONCRETE; // material under wheels uint8_t groundMat = LCR_BLOCK_MATERIAL_CONCRETE; // material under wheels
@ -726,7 +739,7 @@ uint32_t LCR_racingStep(unsigned int input)
{ {
LCR_GameUnit rotateBy = LCR_GameUnit rotateBy =
(LCR_racing.wheelCollisions & 0x0f) ? // on ground slow down wheel rot. (LCR_racing.wheelCollisions & 0x0f) ? // on ground slow down wheel rot.
(LCR_racingGetCarSpeedUnsigned() / 16) : LCR_GAME_UNIT / 32; (LCR_racingGetCarSpeedUnsigned() / 8) : LCR_GAME_UNIT / 32;
if (!(input & LCR_RACING_INPUT_BACK)) if (!(input & LCR_RACING_INPUT_BACK))
rotateBy *= -1; rotateBy *= -1;

View file

@ -1446,12 +1446,12 @@ void _LCR_rendererAnimateCar(void)
LCR_renderer.animatedCarVerts[index + 2] -= LCR_renderer.animatedCarVerts[index + 2] -=
(LCR_renderer.animatedCarVerts[index] * LCR_renderer.wheelSteer) (LCR_renderer.animatedCarVerts[index] * LCR_renderer.wheelSteer)
/ (8 * S3L_F); / (16 * S3L_F); //(8 * S3L_F);
LCR_renderer.animatedCarVerts[index] += LCR_renderer.animatedCarVerts[index] +=
((LCR_renderer.animatedCarVerts[index + 2] - ((LCR_renderer.animatedCarVerts[index + 2] -
LCR_renderer.wheelRotationCenters[2]) * LCR_renderer.wheelSteer) LCR_renderer.wheelRotationCenters[2]) * LCR_renderer.wheelSteer)
/ (2 * S3L_F); / (4 * S3L_F); //(2 * S3L_F);
} }
} }
} }