diff --git a/armorforge/sources/tab_object.ts b/armorforge/sources/tab_object.ts index a7ee2eb0..6d51d5c6 100644 --- a/armorforge/sources/tab_object.ts +++ b/armorforge/sources/tab_object.ts @@ -147,6 +147,7 @@ function tab_object_draw(htab: ui_handle_t) { tr("Box"), tr("Sphere"), tr("Convex Hull"), + tr("Terrain"), tr("Mesh"), ]; hshape.position = pb != null ? pb.shape + 1 : 0; diff --git a/base/plugins/phys_jolt/phys_jolt.cpp b/base/plugins/phys_jolt/phys_jolt.cpp index 91eb04e7..316be22c 100644 --- a/base/plugins/phys_jolt/phys_jolt.cpp +++ b/base/plugins/phys_jolt/phys_jolt.cpp @@ -11,6 +11,7 @@ #include #include #include +#include #include #include #include @@ -117,7 +118,8 @@ typedef enum { physics_shape_BOX = 0, physics_shape_SPHERE = 1, physics_shape_HULL = 2, - physics_shape_MESH = 3, + physics_shape_TERRAIN = 3, + physics_shape_MESH = 4, } physics_shape_t; BPLayerInterfaceImpl broad_phase_layer_interface; @@ -211,6 +213,13 @@ void *_jolt_body_create(int shape, float mass, float dimx, float dimy, float dim shape_settings.SetEmbedded(); result = shape_settings.Create(); } + else if (shape == physics_shape_TERRAIN) { + f32_array_t *f32a = (f32_array_t *)f32a_triangles; + + // HeightFieldShapeSettings shape_settings(); + // shape_settings.SetEmbedded(); + // result = shape_settings.Create(); + } else { // Mesh f32_array_t *f32a = (f32_array_t *)f32a_triangles; diff --git a/base/sources/physics_body.ts b/base/sources/physics_body.ts index 6cdc5db7..5021bdc2 100644 --- a/base/sources/physics_body.ts +++ b/base/sources/physics_body.ts @@ -24,7 +24,8 @@ enum physics_shape_t { BOX = 0, SPHERE = 1, HULL = 2, - MESH = 3, + TERRAIN = 3, + MESH = 4, } let physics_body_object_map: map_t = map_create(); @@ -45,7 +46,8 @@ function physics_body_init(body: physics_body_t, obj: object_t) { let triangles: f32[] = null; if (body.shape == physics_shape_t.MESH || - body.shape == physics_shape_t.HULL + body.shape == physics_shape_t.HULL || + body.shape == physics_shape_t.TERRAIN ) { let mo: mesh_object_t = obj.ext; let data: mesh_data_t = mo.data;