Hi, I'm new at Bullet physics, and I'd like to address a question to the more experienced users.
In my game I have a large terrain map (>500k triangles), which I cannot represent by a heightmap (there are rocks and cliff sides that go "under" the above level).
So, what would be the most optimal solution to be able to collide with this terrain? Split it up in small patches, or use it as a very large mesh? Can Bullet handle that efficiently?
Any suggestions are appreciated.
Collision with large terrain
-
- Posts: 47
- Joined: Mon Aug 16, 2010 10:43 am
Re: Collision with large terrain
I think Bullet will split it automatically. It doesn't take long to create triangle mesh, give it a try.
-
- Posts: 10
- Joined: Wed Oct 11, 2017 4:45 am
Re: Collision with large terrain
I'm struggle with terrain collision
According to the manual: Collision Shapes
According to the manual: Collision Shapes
But I see that many people recommend using triangle mesh (I guess it's btBvhTriangleMeshShape), so Is it because btHeightfieldTerrainShape is currently in unusable state?Is it a moving object? ---No---->Is it a 2D heightfield? ---Yes---> btHeightfieldTerrainShape
-
- Posts: 20
- Joined: Sat Jun 04, 2016 10:34 pm
- Location: Edinburgh
Re: Collision with large terrain
To answer the first poster and the third:
Use btBvhTriangleMeshShape for terrain that requires overhangs, tunnels etc.
Trimeshes require geometry data that consists of vertices and triangle indices and are necessarily more complex input data. That said, tools like Blender export in lots of formats like this.
Use btHeightfieldTerrainShape if you have input data that is represented as a grid of height values. Often loaded as texture grey-scale type data. Use if your terrain is 'convex', i.e. it has no overhangs etc.
Ultimately both use bounding volume hierarchy spatial partitioning. So your terrain can be huge without undue performance loss.
If you want very large terrain areas, chunk up your grids as separate btBvhTriangleMeshShapes and load and unload chunks as you move around the mesh. I've found that you need very large or detailed meshes before you need to go down this road. All depends what you're modelling.
Cheers.
Use btBvhTriangleMeshShape for terrain that requires overhangs, tunnels etc.
Trimeshes require geometry data that consists of vertices and triangle indices and are necessarily more complex input data. That said, tools like Blender export in lots of formats like this.
Use btHeightfieldTerrainShape if you have input data that is represented as a grid of height values. Often loaded as texture grey-scale type data. Use if your terrain is 'convex', i.e. it has no overhangs etc.
Ultimately both use bounding volume hierarchy spatial partitioning. So your terrain can be huge without undue performance loss.
If you want very large terrain areas, chunk up your grids as separate btBvhTriangleMeshShapes and load and unload chunks as you move around the mesh. I've found that you need very large or detailed meshes before you need to go down this road. All depends what you're modelling.
Cheers.