rdBuildBuddy Tutorial 8 – Constructing and Removing Programmatically
Last Updated: 11th May 2024
Tutorial created using rdBuildBuddy 1.00
Sometimes when using the rdBuildBuddy builders, you may want to change things and rebuild.
This is pretty simple, there are some functions built-in to help you.
In this tutorial we will start with a distributed line of objects and change the distribution density during play.
Step 1. Create a new Blueprint SubClassed off BP_rdBuildBuddy_Spline_Distribute
The first step is to create a Blueprint – Subclass it off the “BP_rdBuildBuddy_Spline_Distribute” as we will be distributing objects along a spline.
Step 2. Add to the level and drag out a spline path
Add the new Blueprint to the level and create a path for the objects to be place along.
Step 3. Open the BP in the Editor, Add a new variable for the Number of Columns (RunningDensity)
Now we add a variable to the Blueprint – this variable starts at 1.0 and gets decremented in the Tick Handler. This is multiplied by the NumOfColumns value we chose and set in the Drop-In.
Step 4. Change the default “Number of Columns” to an amount that fits well with your spline
This is the number of objects that get distributed along the spline – for the example we use (see snapshot above) – 30 is a good number.
Step 5. Add an “Object” and assign the mesh
Now add a mesh object to the Object Factory.
Step 6. Change the Tick Interval to 3 seconds
In the Class Defaults of our Blueprint, change the “Tick Interval” from 0.0 to 3.0 – so it ticks once every 3 seconds.
Step 7. Add a Fix to the rdBuildBuddy Object Remove function
If you’re using version 1.00 of rdBuildBuddy, you’ll need to change one of it’s functions to work at run-time. Normally it makes no difference when the setup is done at begin play.
Just change the function “RemoveInstances” in “BP_rdPlacement” to look like below:
Step 8. Add the Code to the EventTick handler
The final step is to add the decrementing density and redraw – add this code to the Event Tick Handler:
Step 9. Done
That’s it – now play your level and watch the amount of objects decrease every 3 seconds.