Using Instanced Static Meshes in C++?
I was looking to start getting into procedural generation and the first thing I need to be able to do is create an instanced static mesh of a floor via C++ but there doesn't seem to be much on this topic or any help is somewhat outdated or isn't explained completely clearly.
What I seemed to be getting from some of the solutions was that I needed to create a new class for every different instanced static mesh I want to use. e.g. A separate class for floors, walls, corners, etc. Am I wrong in thinking this? It would be nice if someone could come in and clear this all up a little bit.
Is there a way to do it similar to the "Generating Procedural Rooms" video by Unreal in which they simply have one blueprint containing all different meshes that they can create new instances of individually? I would prefer to simply have a "ProceduralGeneration" actor class that I can place into the world that contains all the different instanced meshes which I can iterate between inside the class itself.
tl;dr: How to create instanced static meshes in C++ simply.
There's a component called InstancedStaticMeshComponent. You add this component to any actor. This component has a static mesh field where you specify the mesh you want. It also has an "Instances" array where you add all the transforms you want for your static mesh.
Then you can add transforms like this:
The transforms will be relative to your actor's transform.
You can spawn the actor in c++:
You can add as many Instanced static mesh components to your actor as you like.
answered Aug 05 '16 at 01:14 AM
Follow this question
Once you sign in you will be able to subscribe for any updates here