Continue block collisions
This commit is contained in:
parent
f1bbb1e1b6
commit
011cd891c1
5 changed files with 99 additions and 12 deletions
74
racing.h
74
racing.h
|
@ -70,8 +70,80 @@ TPE_Vec3 _LCR_racingBlockEnvFunc(TPE_Vec3 point, const uint8_t *block)
|
|||
(((int) bz) - LCR_MAP_SIZE_BLOCKS / 2) * LCR_PHYSICS_UNIT
|
||||
+ LCR_PHYSICS_UNIT / 2);
|
||||
|
||||
point = TPE_vec3Minus(point,center); // shift to origin
|
||||
|
||||
// TODO: transform
|
||||
|
||||
switch (block[0])
|
||||
{
|
||||
case LCR_BLOCK_FULL:
|
||||
case LCR_BLOCK_BOTTOM:
|
||||
case LCR_BLOCK_LEFT:
|
||||
case LCR_BLOCK_BOTTOM_LEFT:
|
||||
case LCR_BLOCK_BOTTOM_LEFT_FRONT:
|
||||
case LCR_BLOCK_FULL_ACCEL:
|
||||
case LCR_BLOCK_FULL_FAN:
|
||||
{
|
||||
TPE_Vec3
|
||||
offset = TPE_vec3(0,0,0),
|
||||
size = TPE_vec3(LCR_PHYSICS_UNIT / 2,LCR_PHYSICS_UNIT / 4,
|
||||
LCR_PHYSICS_UNIT / 2);
|
||||
|
||||
if (block[0] == LCR_BLOCK_BOTTOM ||
|
||||
block[0] == LCR_BLOCK_BOTTOM_LEFT ||
|
||||
block[0] == LCR_BLOCK_BOTTOM_LEFT_FRONT)
|
||||
{
|
||||
offset.y -= LCR_PHYSICS_UNIT / 8;
|
||||
size.y = LCR_PHYSICS_UNIT / 8;
|
||||
}
|
||||
|
||||
if (block[0] == LCR_BLOCK_LEFT ||
|
||||
block[0] == LCR_BLOCK_BOTTOM_LEFT ||
|
||||
block[0] == LCR_BLOCK_BOTTOM_LEFT_FRONT)
|
||||
{
|
||||
offset.x -= LCR_PHYSICS_UNIT / 4;
|
||||
size.x = LCR_PHYSICS_UNIT / 4;
|
||||
}
|
||||
|
||||
if (block[0] == LCR_BLOCK_BOTTOM_LEFT_FRONT)
|
||||
{
|
||||
offset.z -= LCR_PHYSICS_UNIT / 4;
|
||||
size.z = LCR_PHYSICS_UNIT / 4;
|
||||
}
|
||||
|
||||
point = TPE_envAABox(point,offset,size);
|
||||
break;
|
||||
}
|
||||
|
||||
case LCR_BLOCK_RAMP:
|
||||
case LCR_BLOCK_RAMP_34:
|
||||
case LCR_BLOCK_RAMP_12:
|
||||
case LCR_BLOCK_RAMP_14:
|
||||
{
|
||||
TPE_Unit sides[6];
|
||||
sides[0] = -1 * LCR_PHYSICS_UNIT / 2; sides[1] = -1 * LCR_PHYSICS_UNIT / 2;
|
||||
sides[2] = LCR_PHYSICS_UNIT / 2; sides[3] = -1 * LCR_PHYSICS_UNIT / 2;
|
||||
sides[4] = LCR_PHYSICS_UNIT / 2; sides[5] = LCR_PHYSICS_UNIT / 2;
|
||||
|
||||
point = TPE_envAATriPrism(point,TPE_vec3(0,0,0),sides,LCR_PHYSICS_UNIT,2);
|
||||
break;
|
||||
}
|
||||
|
||||
default:
|
||||
point = TPE_vec3(0,0,LCR_MAP_SIZE_BLOCKS * LCR_PHYSICS_UNIT);
|
||||
break;
|
||||
}
|
||||
|
||||
// TODO: untransform
|
||||
|
||||
point = TPE_vec3Plus(point,center); // shift back
|
||||
|
||||
return point;
|
||||
|
||||
/*
|
||||
return TPE_envAABox(point,center,TPE_vec3(LCR_PHYSICS_UNIT / 2,
|
||||
LCR_PHYSICS_UNIT / 4,LCR_PHYSICS_UNIT / 2));
|
||||
*/
|
||||
}
|
||||
|
||||
TPE_Vec3 _LCR_racingEnvironmentFunction(TPE_Vec3 point, TPE_Unit maxDist)
|
||||
|
@ -504,7 +576,7 @@ void LCR_physicsDebugDraw(LCR_GameUnit camPos[3], LCR_GameUnit camRot[2],
|
|||
cView.z = (camFov * TPE_F) / LCR_GAME_UNIT;
|
||||
|
||||
TPE_worldDebugDraw(&(LCR_racing.physicsWorld),_LCR_drawPhysicsDebugPixel,
|
||||
cPos,cRot,cView,16,LCR_PHYSICS_UNIT / 4);
|
||||
cPos,cRot,cView,16,LCR_PHYSICS_UNIT / 4,LCR_racing.tick * 4);
|
||||
}
|
||||
|
||||
#endif // guard
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue