rdInst Tutorial 11 – Runtime Converting an Instance to a StaticMesh
Last Updated: 27th January 2023
These tools in rdActor allows us to convert any Instance back to a StaticMesh at runtime, either as a ChildActorComponent or as a level Actor, Spawned or Pooled.
This makes it a lot easier to do physical things with the Instance, including fracturing etc.
Step 1. Create the Instance example from Tutorial 5
We’ll use the same Instances as we were in Tutorial 5, except using the “Randomize” ActorMode, so just follow the steps there to create the Blueprint, but set ActorMode to “Randomize”
Step 2. Add Trigger Boxes, like Tutorial 7
Now Add 2 Box Collision Components like we did in Tutorial 7, your Blueprint should now look like:
Step 3. Create the Events to Spawn Actors
The last step is to get those Box Collisions to convert to Actors, one converts to a ChildActor Component, the other is spawned in the level.
These will convert once – this code as GetLastInstanceIndex will return -1 subsequent times, which the rdConvert methods will reject.
New to version 1.10 there are two new conversion types. The first is rdConvertInstanceToActor with the ability to select any actor type, including Blueprints. The second is rdConvertInstanceToActorFromPool which is similar, but uses an Actor Pool that you setup at the start of play.
Step 4. Done
Finished, Play and move over the trigger boxes to convert to actors – you won’t see any difference in the level but it does happen.