Terrain - map editor

Started by
1 comment, last by irbaboon 9 years, 9 months ago

I've been getting into 3D for a while now, and I'm using Bullet Physics for physics, and OpenGL 3+ for graphics.

Up until now, I've used Blender to create a map, and then load it to a btBvhTriangleMeshShape for use in Bullet.

However, I want to create a map editor, and I first thought the easiest way would be to use a heightmap. This requires the entire terrain to be in a grid however, and that makes it hard to make good terrain without making a small grid full of unnecessary vertices. Therefore it seems like I can't use that.

I've tried Googling for resources on how I should go about this, but it's always topics which do not help me.

What I've been thinking about is to make the map in the editor a btBvhTriangleMeshShape, but I don't see any way to quickly modify vertices.

I hope anyone can give me some advice on what I should do.

Thanks.

Advertisement

I would go height map for a terrain editor. Bullet's height map object allows for the map array to be dynamically modified. Creating a new btBvhTriangleMeshShape every time the terrain is modified may or may not be too slow, but using the height map wouldn't require quite as much Bullet-related code.

On the other hand, do you really need physics *while* the terrain is being altered/extruded/etc? You could stop physics, allow the user to extrude (terminology?) a hill, and then start simulating again after building a new btBvhTriangleMeshShape. If your editor includes placing other objects (like debris), you might need to use an invisible sphere to push away other objects before creating a new btBvhTriangleMeshShape. Or even try to detect which non-static objects would need to be moved and just warp them above the new highest point in the area and let them fall back down (the user will have to re-place them, but hey, they rose a hill there).

Disclaimer: I've never written such an editor; I use Blender (poorly).

New C/C++ Build Tool 'Stir' (doesn't just generate Makefiles, it does the build): https://github.com/space222/stir

I would go height map for a terrain editor. Bullet's height map object allows for the map array to be dynamically modified. Creating a new btBvhTriangleMeshShape every time the terrain is modified may or may not be too slow, but using the height map wouldn't require quite as much Bullet-related code.

On the other hand, do you really need physics *while* the terrain is being altered/extruded/etc? You could stop physics, allow the user to extrude (terminology?) a hill, and then start simulating again after building a new btBvhTriangleMeshShape. If your editor includes placing other objects (like debris), you might need to use an invisible sphere to push away other objects before creating a new btBvhTriangleMeshShape. Or even try to detect which non-static objects would need to be moved and just warp them above the new highest point in the area and let them fall back down (the user will have to re-place them, but hey, they rose a hill there).

Disclaimer: I've never written such an editor; I use Blender (poorly).

True, that is an advantage to using a heightmap. But it really limits how you can edit the vertices.

As for the triangle mesh method:

I suppose I can disable physics while editing, which would make it necessary to make a new class which has the vertices. The problem I can see with that, is I would need to reimplement certain features Bullet does for me, such as raycasting.

Anyone else have any thoughts?

This topic is closed to new replies.

Advertisement