Add curved ramp
This commit is contained in:
parent
7d7830073a
commit
9f112e5869
3 changed files with 76 additions and 23 deletions
39
racing.h
39
racing.h
|
@ -127,6 +127,45 @@ TPE_Vec3 _LCR_racingBlockEnvFunc(TPE_Vec3 point, const uint8_t *block)
|
|||
break;
|
||||
}
|
||||
|
||||
case LCR_BLOCK_RAMP_CURVED:
|
||||
{
|
||||
TPE_Vec3 v, vBest;
|
||||
TPE_Unit sides[6], d, dBest;
|
||||
|
||||
sides[0] = LCR_PHYSICS_UNIT / 8;
|
||||
sides[1] = -1 * LCR_PHYSICS_UNIT / 4;
|
||||
sides[2] = LCR_PHYSICS_UNIT / 2;
|
||||
sides[3] = -1 * LCR_PHYSICS_UNIT / 4;
|
||||
sides[4] = LCR_PHYSICS_UNIT / 2;
|
||||
sides[5] = LCR_PHYSICS_UNIT / 4;
|
||||
|
||||
vBest = TPE_envAATriPrism(point,TPE_vec3(0,0,0),sides,LCR_PHYSICS_UNIT,2);
|
||||
dBest = TPE_dist(point,vBest);
|
||||
|
||||
if (dBest != 0)
|
||||
{
|
||||
sides[0] = -1 * LCR_PHYSICS_UNIT / 4;
|
||||
sides[1] = -1 * LCR_PHYSICS_UNIT / 4;
|
||||
sides[2] = LCR_PHYSICS_UNIT / 2;
|
||||
sides[3] = -1 * LCR_PHYSICS_UNIT / 4;
|
||||
sides[4] = LCR_PHYSICS_UNIT / 2;
|
||||
sides[5] = 0;
|
||||
|
||||
v = TPE_envAATriPrism(point,TPE_vec3(0,0,0),sides,LCR_PHYSICS_UNIT,2);
|
||||
d = TPE_dist(point,v);
|
||||
|
||||
if (d < dBest)
|
||||
{
|
||||
vBest = v;
|
||||
dBest = d;
|
||||
}
|
||||
}
|
||||
|
||||
point = vBest;
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
case LCR_BLOCK_RAMP:
|
||||
case LCR_BLOCK_RAMP_34:
|
||||
case LCR_BLOCK_RAMP_12:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue