Continue block collisions

This commit is contained in:
Miloslav Ciz 2024-09-24 14:48:45 +02:00
parent f1bbb1e1b6
commit 011cd891c1
5 changed files with 99 additions and 12 deletions

View file

@ -539,7 +539,7 @@ TPE_Vec3 TPE_bodyGetCenterOfMass(const TPE_Body *body);
e.g. 16). */
void TPE_worldDebugDraw(TPE_World *world, TPE_DebugDrawFunction drawFunc,
TPE_Vec3 camPos, TPE_Vec3 camRot, TPE_Vec3 camView, uint16_t envGridRes,
TPE_Unit envGridSize);
TPE_Unit envGridSize, TPE_Unit offset);
#define TPE_DEBUG_COLOR_CONNECTION 0
#define TPE_DEBUG_COLOR_JOINT 1
@ -592,7 +592,7 @@ TPE_Vec3 TPE_envLineSegment(TPE_Vec3 point, TPE_Vec3 a, TPE_Vec3 b);
TPE_Vec3 TPE_envHeightmap(TPE_Vec3 point, TPE_Vec3 center, TPE_Unit gridSize,
TPE_Unit (*heightFunction)(int32_t x, int32_t y), TPE_Unit maxDist);
/** Environment function for triagnular prism, e.g. for ramps. The sides array
/** Environment function for triangular prism, e.g. for ramps. The sides array
contains three 2D coordinates of points of the triangle in given plane with
respect to the center. WARNING: the points must be specified in counter
clowckwise direction! The direction var specified axis direction (0, 1 or
@ -2079,7 +2079,7 @@ void _TPE_drawDebugPixel(
void TPE_worldDebugDraw(TPE_World *world, TPE_DebugDrawFunction drawFunc,
TPE_Vec3 camPos, TPE_Vec3 camRot, TPE_Vec3 camView, uint16_t envGridRes,
TPE_Unit envGridSize)
TPE_Unit envGridSize, TPE_Unit offset)
{
#define Z_LIMIT 250
if (world->environmentFunction != 0)
@ -2092,6 +2092,8 @@ void TPE_worldDebugDraw(TPE_World *world, TPE_DebugDrawFunction drawFunc,
TPE_Vec3 center;
offset %= envGridSize;
if (envGridRes != 0)
{
center = TPE_vec3(0,TPE_sin(camRot.x),TPE_cos(camRot.x));
@ -2101,9 +2103,9 @@ void TPE_worldDebugDraw(TPE_World *world, TPE_DebugDrawFunction drawFunc,
center = TPE_vec3Times(center,gridHalfSize);
center = TPE_vec3Plus(camPos,center);
center.x = (center.x / envGridSize) * envGridSize;
center.y = (center.y / envGridSize) * envGridSize;
center.z = (center.z / envGridSize) * envGridSize;
center.x = (center.x / envGridSize) * envGridSize + offset;
center.y = (center.y / envGridSize) * envGridSize + offset;
center.z = (center.z / envGridSize) * envGridSize + offset;
}
testPoint.y = center.y - gridHalfSize;