-
Notifications
You must be signed in to change notification settings - Fork 0
Step 8: Vacuum(Magnet) System Guide
The Vacuum System allows players to pull all pickups on the map towards them automatically.
Key Features:
- Pulls ALL pickups on the map (no radius limit)
- Configurable pickup type filtering
- Optimized performance (uses Pool Subsystem)
- Blueprint-friendly events
Add URFVacuumComponent to your player character Blueprint.
Create a new Blueprint based on URFPickupActor:
- Right-click in Content Browser → Blueprint Class →
URFPickupActor - Name it
BP_VacuumPickup - Set
Pickup Type= Vacuum - Configure vacuum settings:
-
Only XP= true (vacuum only XP pickups) - OR
Only XP= false + add types toVacuum Pickup Typesarray
-
- Spawn some XP pickups on the map
- Spawn the Vacuum pickup
- Collect the Vacuum pickup
- Watch all XP pickups fly towards you!
| Property | Type | Default | Description |
|---|---|---|---|
Vacuum Speed |
float | 1500.0 | Speed at which pickups move towards player |
Collection Threshold |
float | 50.0 | Distance at which pickups are collected |
Show Debug Info |
bool | false | Enable debug visualization |
| Property | Type | Default | Description |
|---|---|---|---|
Pickup Type |
enum | Experience | Set to Vacuum |
Only XP |
bool | true | If true, only vacuum XP pickups |
Vacuum Pickup Types |
array | empty | Pickup types to vacuum (if Only XP = false) |
Setup:
BP_VacuumPickup
├─ Pickup Type: Vacuum
└─ Only XP: true
Result: Only XP pickups will be vacuumed.
Setup:
BP_VacuumPickup
├─ Pickup Type: Vacuum
├─ Only XP: false
└─ Vacuum Pickup Types:
├─ [0] Experience
└─ [1] Currency
Result: Both XP and Currency pickups will be vacuumed.
Setup:
BP_VacuumPickup
├─ Pickup Type: Vacuum
├─ Only XP: false
└─ Vacuum Pickup Types:
├─ [0] Experience
├─ [1] Currency
└─ [2] Health
Result: All pickup types will be vacuumed.
Called when vacuum is activated.
Event OnVacuumActivated
↓
Play Sound (Vacuum Start)
↓
Spawn Particle Effect
Called when a pickup is vacuumed.
Event OnPickupVacuumed (Pickup Type)
↓
Switch on Pickup Type
├─ Experience → Play XP Sound
├─ Currency → Play Gold Sound
└─ Health → Play Health Sound
Called when all pickups are collected.
Event OnVacuumCompleted
↓
Play Sound (Vacuum Complete)
↓
Stop Particle Effect
Activate vacuum manually without collecting a pickup:
Get Vacuum Component
↓
Activate Vacuum (Only XP = true, Allowed Types = [])
Use Cases:
- Ability/skill that vacuums pickups
- Automatic vacuum on level up
- Vacuum on button press
Add visual effects when vacuum is active:
Event OnVacuumActivated
↓
Spawn Emitter Attached (Vacuum Particle)
↓
Play Sound (Vacuum Loop)
Event OnVacuumCompleted
↓
Destroy Particle
↓
Stop Sound
Enable debug visualization to see vacuum in action:
- Select Vacuum Component
- Set
Show Debug Info= true - Play
Debug Display:
- Green sphere: Collection threshold
- Cyan lines: Pickups being vacuumed
Problem: Vacuum pickup collected but nothing happens.
Solution:
- Check player has
URFVacuumComponent - Check
Pickup Type= Vacuum - Enable
Show Debug Infoon Vacuum Component
Problem: Vacuum pulls wrong pickup types.
Solution:
- Check
Only XPsetting - If
Only XP= false, checkVacuum Pickup Typesarray
Problem: Pickups reach player but don't collect.
Solution:
- Check
Collection Threshold(increase if needed) - Verify pickup collision is enabled
- Check player has required components (XP, Currency, etc.)
Too Fast (3000+): Pickups teleport, looks unnatural
Too Slow (500-): Takes too long, frustrating
Recommended: 1500-2000
Too Small (10-20): Pickups might miss player
Too Large (100+): Pickups collected too early
Recommended: 50-75
Always provide:
- Sound effect (vacuum start)
- Particle effect (visual indicator)
Good Use Cases:
- End of wave reward
- Rare pickup drop
- Player ability/skill
- Emergency loot collection
Bad Use Cases:
- Always active (removes challenge)
- Too frequent (devalues mechanic)
Make it Valuable:
- Rare drop (1-5% chance)
- Limited duration (5-10 seconds)
- Cooldown (30-60 seconds)
// Activate vacuum
VacuumComponent->ActivateVacuum(bOnlyXP, AllowedTypes);
// Stop vacuum
VacuumComponent->StopVacuum();
// Check if active
bool bActive = VacuumComponent->IsVacuumActive();
// Get vacuumed pickup count
int32 Count = VacuumComponent->GetVacuumedPickupCount();