rdInst Tutorial 11.6 – Scanning Entities for Impacts


When firing projectiles in your game, they can often fire past the close range Proxy Actors into the VAT area – to still be able to process them from Actors, a small component can be added to your projectile that queues scans just ahead of where it is and its velocity. The ECS thread then scans these and triggers swaps to the Proxy Actors when there will potentially be a collision. If after 10 frames there is no collision, it’s swapped back to a VAT.

This tutorial shows adding this component to your projectiles. It also shows how to remove Entities from the level.


Step 1. Create a level based on the Shooter template (include all weapons)

The first step is to create a First Person Shooter level, based on the Project Template, or add the Content from the Add button in the Content Browser:


Step 2. Add the rdProxyscan Component to the projectile and code Entity Checks

Open up the BP_ShooterProjectileBase Blueprint (Variant_Shooter/Blueprints/Pickups/Projectiles) and add a rdProxyScan Component – that takes care of swapping in Proxies for Entities in front of the projectiles velocity.

Depending on the speed of your projectile, you can tone down the tick frequency as an optimization (it just queues so has no overhead in the game thread).

Now we want to also cater for explosions – we need to scan the area affected by the explosion and swap any Entities to proxies before running any impulses or forces. Add this Code to the BeginPlay to set up the OnDamage Delegate – this gets fired after the Proxies have been swapped in.

Now add the code below (replacing the call to ProcessHit) to Queue the Scan-and-Swap routine.


Step 3. Create a level that spawns Entities from Tutorial 11.4.

Create a Basic level, either expand the floor or create a landscape.

Add a NavMesh to the level, then add an rdNPCSpawner actor, making it cover the same area as the NavMesh.

Add some weapon Pickups to the level and set the GameMode to BP_FirstPersonGameMode:

Then add a simple spawner BP that calls the ECS Spawner


Step 4. Done, Test

That’s it, now just play the level, pick up a weapon and start shooting the NPCs, both in the distance and close up to see the effect on either real actors and VATs.