Geometry scripting is much like procedural mesh component, but it comes with alot of handy functions which can make life a lot easier. You can use GS(Geometry scripting) at runtime as well as in editor.
For runtime you need to use the DynamicMeshActor and for editor use the Generated dynamic mesh actor.
In Editor
- Override the On Generated function.
- Get the target mesh and append box.
- You can use Apply Boolean function as well.
- If you want to make a temporary mesh you can use the Allocate Mesh node and then append shapes or do anything you like just to make sure to use release all allocated meshes right before the end to do clean up.
Baking Mesh To Static Mesh
You can bake your mesh to a static mesh easily you need a variable of type Static Mesh as public this is where our dynamic mesh will update and write to.

Notice the NewMaterials and NewMaterialSlotNames in the options this is for, if we want to have multiple slots in our dynamic mesh actor.
Material Slots
To have multiple slots on the baked mesh you need to do this:

Use this Remap Material ID node with the ToMaterialID parameter to which ever slot you like.
Once that is done you need one more node right before you release the allocated mesh:

The Floor and Wall materials here are public variables of type MaterialInterface which the user can set in editor.
Top comments (0)