Skip to content

Step 8: Vacuum(Magnet) System Guide

Can TATAR edited this page Feb 23, 2026 · 1 revision

Vacuum System Guide

Overview

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

Quick Start

1. Add Vacuum Component to Player

Add URFVacuumComponent to your player character Blueprint.

2. Create Vacuum Pickup

Create a new Blueprint based on URFPickupActor:

  1. Right-click in Content Browser → Blueprint Class → URFPickupActor
  2. Name it BP_VacuumPickup
  3. Set Pickup Type = Vacuum
  4. Configure vacuum settings:
    • Only XP = true (vacuum only XP pickups)
    • OR Only XP = false + add types to Vacuum Pickup Types array

3. Test

  1. Spawn some XP pickups on the map
  2. Spawn the Vacuum pickup
  3. Collect the Vacuum pickup
  4. Watch all XP pickups fly towards you!

Configuration

Vacuum Component Settings

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

Vacuum Pickup Settings

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)

Usage Examples

Example 1: XP Only Vacuum

Setup:

BP_VacuumPickup
├─ Pickup Type: Vacuum
└─ Only XP: true

Result: Only XP pickups will be vacuumed.

Example 2: Multi-Type Vacuum

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.

Example 3: All Pickups Vacuum

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.


Blueprint Events

Vacuum Component Events

OnVacuumActivated

Called when vacuum is activated.

Event OnVacuumActivated
  ↓
Play Sound (Vacuum Start)
  ↓
Spawn Particle Effect

OnPickupVacuumed

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

OnVacuumCompleted

Called when all pickups are collected.

Event OnVacuumCompleted
  ↓
Play Sound (Vacuum Complete)
  ↓
Stop Particle Effect

Advanced Usage

Manual Vacuum Activation

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

Custom Vacuum Effects

Add visual effects when vacuum is active:

Event OnVacuumActivated
  ↓
Spawn Emitter Attached (Vacuum Particle)
  ↓
Play Sound (Vacuum Loop)

Event OnVacuumCompleted
  ↓
Destroy Particle
  ↓
Stop Sound

Debug Visualization

Enable debug visualization to see vacuum in action:

  1. Select Vacuum Component
  2. Set Show Debug Info = true
  3. Play

Debug Display:

  • Green sphere: Collection threshold
  • Cyan lines: Pickups being vacuumed

Troubleshooting

Vacuum Not Working

Problem: Vacuum pickup collected but nothing happens.

Solution:

  1. Check player has URFVacuumComponent
  2. Check Pickup Type = Vacuum
  3. Enable Show Debug Info on Vacuum Component

Wrong Pickups Vacuumed

Problem: Vacuum pulls wrong pickup types.

Solution:

  1. Check Only XP setting
  2. If Only XP = false, check Vacuum Pickup Types array

Pickups Not Collected

Problem: Pickups reach player but don't collect.

Solution:

  1. Check Collection Threshold (increase if needed)
  2. Verify pickup collision is enabled
  3. Check player has required components (XP, Currency, etc.)

Best Practices

Vacuum Speed

Too Fast (3000+): Pickups teleport, looks unnatural
Too Slow (500-): Takes too long, frustrating
Recommended: 1500-2000

Collection Threshold

Too Small (10-20): Pickups might miss player
Too Large (100+): Pickups collected too early
Recommended: 50-75

Visual Feedback

Always provide:

  • Sound effect (vacuum start)
  • Particle effect (visual indicator)

Design Tips

When to Use Vacuum

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)

Balancing Vacuum

Make it Valuable:

  • Rare drop (1-5% chance)
  • Limited duration (5-10 seconds)
  • Cooldown (30-60 seconds)

Code Reference

Key Functions

// 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();

Clone this wiki locally