[Feature request] Destructible Terrain
ElsAr4e opened this issue · 6 comments
I would like to have the option that some materials and/or specific area(s) of the terrain can be destroyed.
You should be able to exclude specific area(s) or materials - For example rock texture can't be "destroyed", concrete texture just a bit.
Ideally you should be able to set the texture of the destroyed material so that a grass texture will be replaced for example by a burned soil.
And maybe you can set the maximum high that can be removed - for example if you create a FPS-Shooter even if you use a grenade launcher only 2 meters of the terrain can be removed - not more?
A high-level feature such as this one can currently be done already by editing pixels of the heightmap (which can be obtained with terrain.data.get_image(HTerrainData.CHANNEL_HEIGHT)
, and then calling notify_region_changed
to upload the changes.
Something more challenging however is updating the collider. The plugin uses Godot's heightmap collider which does not allow to modify specific areas without recreating the entire collider, which is not viable. But given the nature of heightmaps, this should be possible to implement easily. But it has to be added to Godot Engine.
@MGilleronFJ So I should actually mention this feature request here:
https://github.com/godotengine/godot-proposals?
The plugin uses Godot's heightmap collider which does not allow to modify specific areas without recreating the entire collider, which is not viable.
Can't several smaller heightmap colliders be used in a grid pattern?
@Calinou maybe, but I would really not like to fallback on this and call it done, because it's so stupidly simple (and faster) to update pixels that it's gotta be possible to have xD Perhaps both can be done, even though partial collider update makes chunking irrelevant