Unreal Engine Spike Trap: Build a Damage Trap With a Warning
How to build an Unreal Engine spike trap: a plate with nine spikes on a 4 second cycle, a red warning glow, 20 damage once per cycle and a launch, built and debugged by an AI from one request.
A spike trap in Unreal Engine is three small ideas: a cycle that repeats, a warning so the player has a fair chance, and a hit that only counts when the spikes are up and the player is on the plate. The easiest way to build one is to ask an AI for the whole trap in a single request, with its cycle, warning glow, damage and launch.
In this walkthrough, Ultimate Engine CoPilot builds a stone spike trap that warns, hits once per cycle and flings the player. You get the exact prompt, the two bugs the tests found and a plain explanation of how a trap works.
What the finished trap does
You stand on a flat stone plate. It starts to glow red. A second later, nine spikes shoot up out of the plate, your health drops and you are thrown up into the air. The spikes slide back down and the plate goes grey. Four seconds later, it starts again.

The spikes are up, the plate glows red and the player has been flung into the air.
The prompt
Copy this, change the damage or the cycle time, and see what the AI builds:
Make a spike trap with damage. The player's Vitality is the CurrentHealth and MaxHealth of the existing WBP_HUD in /Game/Frostfang/UI, so reduce the CurrentHealth there and do not add any new variables to the player. Create BP_SpikeTrap in /Game/Series/EP29_SpikeTrap, a flat stone plate 300 by 300 units with 9 grey cone spikes on it in a 3 by 3 grid. The spikes are hidden below the plate at first. Every 4 seconds they shoot up 80 units in 0.15 seconds, stay up for 1 second, then retract in 0.4 seconds. A red warning glow on the plate starts 1 second before the spikes come up. If the player is standing on the plate when the spikes are up, the Vitality drops by 20, once per spike cycle, and the player is flung 300 units up so it is clear what happened. Keep the cycle time, the damage and the warning time as variables. Place two traps on the snow near the player start, 700 units apart, one of them offset by 2 seconds so they are out of sync. Then play test it: put the player on a trap, check the warning glow comes first, check Vitality drops by 20 exactly once per cycle, check the player is flung, and fix anything that does not work.
This time the request tells the AI where the player’s health lives: the CurrentHealth of the existing HUD widget. That matters. The first time this was tried, the AI looked for a Vitality variable on the player, did not find one and stopped to ask where to put it. It did not want to edit your player without permission. Tell it where the health lives and it goes straight to building.
How the AI builds it
The AI reads the project and finds the HUD and the CurrentHealth value it should change. Then the assets appear: two materials (stone with a red glow for the plate, and grey for the spikes) and the trap Blueprint.
The graph is a repeating cycle. A red glow for one second. Then one timeline drives the spikes: up in 0.15 seconds, held, and down again. And a hit check while the spikes are up.

The trap graph: the cycle loop, the spike timeline and the hit check.
Two bugs found by testing
- The plate lost its size. The plate had become the actor’s root, so its size was ignored and it showed as a plain 100 unit cube. The AI added a separate root and put everything else under it.
- The glow read the wrong color. From its own screenshot the AI saw the glow read cream, then amber, against the bright snow. So it darkened the stone while the glow is on and lowered the emissive, and now it reads red.
The AI also moved the traps. The snow next to the player start slopes about 16 degrees, so a flat plate would be half buried. The traps went to flatter snow, a bit further away.
The play test
- The spikes are hidden at the start of the warning, then they rise exactly 80 units and retract fully.
- No hit when the player is off the plate.
- Health goes from 100 to 80 after one cycle.
- The player is flung 260 units above the standing height and is still rising when sampled.
- Trap B is hidden while trap A is up, and rises about 2 seconds later.
The report

The fixes, and the things you may trip over.
The report lists the variables: the cycle time, the damage and the warning time, plus two more it added, a start offset for the out of sync trap and the launch height. It also tells you about things you may trip over:
- The health number on the HUD drops, but the bar fill does not move, because nothing in the HUD updates it. The AI left that alone, since you asked only for the number.
- The hit zone reaches 110 units above the plate, so a low jump over raised spikes still counts as a hit.
- The fling is calculated for the level’s gravity of minus 980. A different gravity setting would change the height.
- One assert in a screenshot-only run failed because the check landed just as the spikes started rising. That was test timing, not the trap.
How a spike trap works, in plain words
The trap repeats every 4 seconds. First the red glow turns on. One second later, a timeline starts. It goes from 0 to 1, and that value moves the spikes from hidden to 80 units up. Held for a second, then back down.
The hit is one check: are the spikes fully up, and is the player over the plate? If yes, subtract 20 from the health and launch the player upward. Because a flag remembers that this cycle already hit, it only happens once. And because the cycle time, the damage and the warning time are variables, you can make a slow, gentle trap or a fast and deadly one with three numbers.
Ideas to extend it
- A longer warning on the first level, and a shorter one later.
- A clicking sound before the spikes rise.
- Traps that move in a pattern, like a row of five, one after the other.
Four tips for trap prompts
- Say where the health lives.
- Give the cycle, the damage and the warning as numbers.
- Say that the damage happens once per cycle.
- Ask the AI to test the warning before the hit.
Frequently asked questions
How do I make a spike trap in Unreal Engine 5?
Run a repeating cycle with a warning, move the spikes with a timeline and check on each cycle whether the spikes are up and the player is on the plate. Apply damage once per cycle.
How do I make sure the trap only damages once per cycle?
Use a flag that is set on the first hit and cleared at the start of the next cycle. Say “once per cycle” in the request, because the AI builds the rule you ask for.
Why did the AI ask me a question the first time?
It looked for a Vitality variable on the player and did not find one. Telling it that the health is the CurrentHealth of the HUD widget lets it build straight away.
Try it in your project
See what Ultimate Engine CoPilot can build on the product page, or get it on Fab.
More builds from this series: the Unreal Engine fall damage, the Unreal Engine health pickup and the Unreal Engine campfire.