rdInst Tutorial 2.5 – Using AutoDestruction


AutoDestruction with rdInst is set up in the same way as Proxies – there is a section in the Proxy Setup Window at the bottom that allows you to enable it.

Once enabled, and a call to “rdProcessImpact” has been added to your projectiles (or weapons) with collisions – you’ll have instances swap to destructible proxies when close to an impact.

This tutorial enlarges on Tutorial 2.2 – it adds projectile Destruction Proxies to the cubes which then interact with the projectile.


Step 1. Duplicate (or recreate) the project in Tutorial 2.3

This tutorial follows up on Tutorial 2.3’s project, so make that, and then follow along from Step 2. here.


Step 2. Edit the Proxy Settings

Now select the cube that you created the Proxy Settings for in the previous step, and enable the Destruction Proxy by ticking the tick-box near the bottom:


Step 3. Edit the Cube Proxy Blueprint

Open the Cube Proxy Actor you created previously and select the cube in the viewport. In the details panel, find the Events section, and click the “+” on the “On Component Hit” event.

In the event code, add a PrintString that says “Ouch” – this is just so we can test it’s all working.


Step 4. Edit the Projectile Blueprint

Now open the BP_Projectile Blueprint in the FirstPerson folder:

We want to change the EventHit in there, atm it applies an Impulse to the hit object, which is the ISM at that point – we remove the code calling ApplyImpulse and Destroy Projectile and replace it with a call to rdProcessImpactProxies if the Hit Object has no physics – if it does have physics, it’s something already in the level that it should hit, so just get it to call the OnDamage event.

The rdProcessImpactProxies routine scans the area around the hit and swaps any close by ISMs to their proxies so any physics from the impact collision can also affect them. You can control the radius of the scan – for things like bullet projectiles this distance can be very small – for things like cluster bombs you’ll want it quite large.

This routine calls an event once these proxies are swapped, so in the Projectile BP we want to add a hook to the delegate and move the nodes that were in the ComponentHit event over to there.


Step 5. Add a weapon to the level

Next just add a weapon (or 3) to the level so you have something to shoot with.


Step 6. Done, shoot some cubes

That’s it – now just play the level and shoot the cubes.