Add ramp corner
This commit is contained in:
parent
c145933004
commit
485b09ccbc
3 changed files with 67 additions and 3 deletions
54
racing.h
54
racing.h
|
@ -207,6 +207,60 @@ TPE_Vec3 _LCR_racingBlockEnvFunc(TPE_Vec3 point, const uint8_t *block)
|
|||
|
||||
#undef _CHECK_NEXT
|
||||
|
||||
case LCR_BLOCK_RAMP_CORNER:
|
||||
{
|
||||
TPE_Unit sides[6];
|
||||
|
||||
sides[0] = -1 * LCR_PHYSICS_UNIT / 2;
|
||||
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;
|
||||
|
||||
if (point.x > LCR_PHYSICS_UNIT / 2)
|
||||
{
|
||||
sides[4] *= -1;
|
||||
|
||||
point = TPE_envAATriPrism(point,TPE_vec3(0,0,0),
|
||||
sides,LCR_PHYSICS_UNIT,2);
|
||||
}
|
||||
else if (point.z < -1 * LCR_PHYSICS_UNIT / 2)
|
||||
point = TPE_envAATriPrism(point,TPE_vec3(0,0,0),
|
||||
sides,LCR_PHYSICS_UNIT,0);
|
||||
else if (point.y < -1 * LCR_PHYSICS_UNIT / 4)
|
||||
{
|
||||
sides[1] *= 2;
|
||||
sides[3] *= 2;
|
||||
sides[5] *= 2;
|
||||
|
||||
point = TPE_envAATriPrism(point,
|
||||
TPE_vec3(0,0,0),sides,LCR_PHYSICS_UNIT / 2,1);
|
||||
}
|
||||
else
|
||||
{
|
||||
point = TPE_envHalfPlane(point,TPE_vec3(LCR_PHYSICS_UNIT / 2,
|
||||
LCR_PHYSICS_UNIT / 4,-1 * LCR_PHYSICS_UNIT / 2),
|
||||
TPE_vec3(-1 * LCR_PHYSICS_UNIT,2 * LCR_PHYSICS_UNIT,LCR_PHYSICS_UNIT));
|
||||
|
||||
#define LINESNAP(a,b,c,d,e,f)\
|
||||
point = TPE_envLineSegment(point,\
|
||||
TPE_vec3(a * LCR_PHYSICS_UNIT / 2,b * LCR_PHYSICS_UNIT / 4,\
|
||||
c * LCR_PHYSICS_UNIT / 2),TPE_vec3(d * LCR_PHYSICS_UNIT / 2,\
|
||||
e * LCR_PHYSICS_UNIT / 4,f * LCR_PHYSICS_UNIT / 2));
|
||||
|
||||
if (point.y < -1 * LCR_PHYSICS_UNIT / 4)
|
||||
LINESNAP(-1,-1,-1,1,-1,1)
|
||||
else if (point.x > LCR_PHYSICS_UNIT / 2)
|
||||
LINESNAP(1,1,-1,1,-1,1)
|
||||
else if (point.z < -1 * LCR_PHYSICS_UNIT / 2)
|
||||
LINESNAP(-1,-1,-1,1,1,-1)
|
||||
#undef LINESNAP
|
||||
}
|
||||
|
||||
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