Page 1 of 1

Concave flat plane

Posted: Sat Sep 07, 2019 9:55 am
by Gad
Hello everybody,
I'm building a small FPS game using libGDX with the Java port of Bullet. In my game I got walls which are just regular boxes and also floors. The floors can have concave shapes (But they're always flat planes). AFAIK, having concave shapes is bad for performance. Any idea how to make to make these floors shapes "solid" according to their concave shape?
One idea I had is to breakdown the concave plane of the floor into triangles using Delauney and make each triangle as a rigid body. The downside of this is that now for each floor I'll have many triangle rigid bodies.

Re: Concave flat plane

Posted: Mon Sep 09, 2019 5:57 pm
by voblivion
If you don't have romms on top to one another, I believe you could use a heightfield as it is an optimized concave shape for that purpose. That said it wouldn't allow you any concave shape (never used it but from my understanding the resolution is the same everywhere on the heightfield so it would require you to do some subdivision work for it to work on your random concave shapes). ... Shape.html

Another option I would see if you don't have any room above another is to write your own heightfield-like shape that can retrieve altitude of the ground on your random shape.

If you really need to support rooms above other and are concerned about performance of using concave shapes, I would suggest first you do a performance test, then you could try to write your own heightfield terrain that "ignores" collision if other collider is below a certain altitude. I'm not very clear but you should be able to figure it out if you look into what btHeightfieldTerrainShape is doing.


Re: Concave flat plane

Posted: Wed Sep 11, 2019 6:25 pm
by Gad
Currently I don't plan on making rooms above rooms, but rooms can have different heights (for example room A can have floor at Y=1 and ceiling at Y=3, and room B can have floor at Y=5 and ceiling at Y=7).
I'll read more about these heightfields.