I’m trying to make a crater on a terrain after an explosion. I dont know how to go about this. any suggestion?
You need to do a few steps:
-
figure out the terrain heightmap location from your explosion’s world position
-
deform the terrain, including any splatmap changes you want
-
write it back to the terrain so Unity can use it
Step 1 is the trickiest, however there are plenty of web examples of converting from world space to find a spot on the terrain. In fact, my makegeo project has examples that can make this computation, such as in the TerrainRampMaker example.
MakeGeo is presently hosted at these locations:
I wanted to see this work too so I made a cheap-and-cheerful demo of terrain deformation from a thrown grenade.
The code is all available in my open-source MakeGeo project. Search for the TerrainDamager scene. It doesn’t do splatmaps yet but maybe soonish.
MakeGeo is presently hosted at these locations:
Thanks!