Fix collision bug
This commit is contained in:
parent
fa66324833
commit
28a1256a88
2 changed files with 30 additions and 18 deletions
21
assets.h
21
assets.h
|
@ -27,22 +27,17 @@ static const uint8_t map1[] =
|
||||||
0,
|
0,
|
||||||
|
|
||||||
LCR_MAP_BLOCK(LCR_BLOCK_RAMP,36,0,32,LCR_BLOCK_MATERIAL_CONCRETE,0),
|
LCR_MAP_BLOCK(LCR_BLOCK_RAMP,36,0,32,LCR_BLOCK_MATERIAL_CONCRETE,0),
|
||||||
LCR_MAP_BLOCK(LCR_BLOCK_RAMP,35,0,32,LCR_BLOCK_MATERIAL_CONCRETE,0),
|
LCR_MAP_BLOCK(LCR_BLOCK_CUBOID_FILL,10,1,1,0,0),
|
||||||
LCR_MAP_BLOCK(LCR_BLOCK_RAMP,34,0,32,LCR_BLOCK_MATERIAL_CONCRETE,0),
|
|
||||||
LCR_MAP_BLOCK(LCR_BLOCK_RAMP,33,0,32,LCR_BLOCK_MATERIAL_CONCRETE,0),
|
|
||||||
|
|
||||||
LCR_MAP_BLOCK(LCR_BLOCK_FULL,33,0,33,LCR_BLOCK_MATERIAL_CONCRETE,0),
|
LCR_MAP_BLOCK(LCR_BLOCK_RAMP,46,0,33,LCR_BLOCK_MATERIAL_CONCRETE,LCR_BLOCK_TRANSFORM_ROT_90),
|
||||||
LCR_MAP_BLOCK(LCR_BLOCK_FULL,33,0,34,LCR_BLOCK_MATERIAL_CONCRETE,0),
|
LCR_MAP_BLOCK(LCR_BLOCK_CUBOID_FILL,1,1,10,0,0),
|
||||||
LCR_MAP_BLOCK(LCR_BLOCK_FULL,33,0,35,LCR_BLOCK_MATERIAL_CONCRETE,0),
|
|
||||||
LCR_MAP_BLOCK(LCR_BLOCK_FULL,33,0,36,LCR_BLOCK_MATERIAL_CONCRETE,0),
|
|
||||||
LCR_MAP_BLOCK(LCR_BLOCK_FULL,33,1,36,LCR_BLOCK_MATERIAL_CONCRETE,0),
|
|
||||||
|
|
||||||
LCR_MAP_BLOCK(LCR_BLOCK_FULL,34,0,33,LCR_BLOCK_MATERIAL_CONCRETE,0),
|
LCR_MAP_BLOCK(LCR_BLOCK_FULL,36,0,33,LCR_BLOCK_MATERIAL_CONCRETE,0),
|
||||||
LCR_MAP_BLOCK(LCR_BLOCK_FULL,34,0,34,LCR_BLOCK_MATERIAL_CONCRETE,0),
|
LCR_MAP_BLOCK(LCR_BLOCK_CUBOID_FILL,10,1,10,0,0),
|
||||||
LCR_MAP_BLOCK(LCR_BLOCK_FULL,34,0,35,LCR_BLOCK_MATERIAL_CONCRETE,0),
|
|
||||||
LCR_MAP_BLOCK(LCR_BLOCK_FULL,34,0,36,LCR_BLOCK_MATERIAL_CONCRETE,0),
|
LCR_MAP_BLOCK(LCR_BLOCK_FULL,36,0,43,LCR_BLOCK_MATERIAL_CONCRETE,0),
|
||||||
|
LCR_MAP_BLOCK(LCR_BLOCK_CUBOID_FILL,10,4,1,0,0),
|
||||||
|
|
||||||
LCR_MAP_BLOCK(LCR_BLOCK_RAMP,32,32,32,LCR_BLOCK_MATERIAL_CONCRETE,LCR_BLOCK_TRANSFORM_ROT_180),
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
LCR_MAP_BLOCK(LCR_BLOCK_FULL_ACCEL,0,0,0,LCR_BLOCK_MATERIAL_CONCRETE,0),
|
LCR_MAP_BLOCK(LCR_BLOCK_FULL_ACCEL,0,0,0,LCR_BLOCK_MATERIAL_CONCRETE,0),
|
||||||
|
|
25
racing.h
25
racing.h
|
@ -20,6 +20,9 @@ typedef int32_t LCR_GameUnit; ///< abstract game unit
|
||||||
#include "tinyphysicsengine.h"
|
#include "tinyphysicsengine.h"
|
||||||
|
|
||||||
// TODO: move some of this to constants?
|
// TODO: move some of this to constants?
|
||||||
|
|
||||||
|
#if 0
|
||||||
|
|
||||||
#define LCR_GRAVITY (LCR_PHYSICS_UNIT / 100)
|
#define LCR_GRAVITY (LCR_PHYSICS_UNIT / 100)
|
||||||
#define LCR_CAR_FORWARD_FRICTION (TPE_F / 11)
|
#define LCR_CAR_FORWARD_FRICTION (TPE_F / 11)
|
||||||
#define LCR_CAR_TURN_FRICTION (4 * TPE_F / 4)
|
#define LCR_CAR_TURN_FRICTION (4 * TPE_F / 4)
|
||||||
|
@ -28,6 +31,20 @@ typedef int32_t LCR_GameUnit; ///< abstract game unit
|
||||||
#define LCR_CAR_TURN_SPEED (LCR_GAME_UNIT / 20)
|
#define LCR_CAR_TURN_SPEED (LCR_GAME_UNIT / 20)
|
||||||
#define LCR_CAR_TURN_MAX (LCR_GAME_UNIT / 4)
|
#define LCR_CAR_TURN_MAX (LCR_GAME_UNIT / 4)
|
||||||
|
|
||||||
|
#else
|
||||||
|
|
||||||
|
#define LCR_GRAVITY (LCR_PHYSICS_UNIT / 140)
|
||||||
|
#define LCR_CAR_FORWARD_FRICTION (TPE_F / 9)
|
||||||
|
#define LCR_CAR_TURN_FRICTION (4 * TPE_F / 4)
|
||||||
|
#define LCR_CAR_ELASTICITY (TPE_F / 110)
|
||||||
|
#define LCR_CAR_ACCELERATION (LCR_PHYSICS_UNIT / 16)
|
||||||
|
#define LCR_CAR_TURN_SPEED (LCR_GAME_UNIT / 20)
|
||||||
|
#define LCR_CAR_TURN_MAX (LCR_GAME_UNIT / 4)
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#define LCR_CAR_JOINTS 5
|
#define LCR_CAR_JOINTS 5
|
||||||
#define LCR_CAR_CONNECTIONS 10
|
#define LCR_CAR_CONNECTIONS 10
|
||||||
|
|
||||||
|
@ -72,11 +89,11 @@ TPE_Vec3 _LCR_racingBlockEnvFunc(TPE_Vec3 point, const uint8_t *block)
|
||||||
uint8_t transform =
|
uint8_t transform =
|
||||||
LCR_mapBlockOppositeTransform(LCR_mapBlockGetTransform(block));
|
LCR_mapBlockOppositeTransform(LCR_mapBlockGetTransform(block));
|
||||||
|
|
||||||
LCR_TRANSFORM_COORDS(transform,point.x,point.y,point.z,(LCR_PHYSICS_UNIT / 2),
|
LCR_TRANSFORM_COORDS(transform,point.x,point.y,point.z,LCR_PHYSICS_UNIT,
|
||||||
(LCR_PHYSICS_UNIT / 4))
|
(LCR_PHYSICS_UNIT / 2))
|
||||||
|
|
||||||
point = TPE_vec3Minus(point,TPE_vec3(
|
point = TPE_vec3Minus(point,
|
||||||
LCR_PHYSICS_UNIT / 2,LCR_PHYSICS_UNIT / 4,LCR_PHYSICS_UNIT / 2));
|
TPE_vec3(LCR_PHYSICS_UNIT / 2,LCR_PHYSICS_UNIT / 4,LCR_PHYSICS_UNIT / 2));
|
||||||
|
|
||||||
switch (block[0])
|
switch (block[0])
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue