Skip to content
Pablo Rodriguez

Projectile System

Create a new Actor_Projectile blueprint with essential components:

  • Sphere Collision: Root component for physics and collision
  • Static Mesh Sphere: Visual representation (attached to collision)
  • Projectile Movement Component: Handles physics and trajectory
  • Sphere Scale: 0.5 for all axes (smaller visual projectile)
  • Sphere Collision: Custom collision, ignore all, overlap pawn only
  • Static Mesh: No collision, no overlap events (visual only)
  • Projectile Movement: Initial speed 1000, max speed 1000, gravity scale 0

Configure projectile physics for different projectile types:

  • Standard Projectiles: Gravity scale 0 for straight-line travel
  • Grenades: Gravity scale 1 for arcing trajectories
  • Arrows/Bolts: High speed (3000) with minimal gravity

Implement hit detection for projectiles:

// Projectile Hit Detection
OnProjectileHitboxOverlap(OtherActor) {
if (OtherActor != Owner) {
if (IsChildClassOf(OtherActor, Character)) {
Interface_Health_Modify(OtherActor, Subtract, Damage);
StopMovementImmediately();
SpawnVFXAtLocation();
DestroyProjectileAfterDelay(0.2);
}
}
}

Enable projectile interaction with environment:

  • World Static: Allow collision with static environment objects
  • World Dynamic: Allow collision with moveable objects
  • Hit Registration: Projectiles stop and spawn VFX on environmental hits

Create reusable function for spawning projectiles:

  • Skeletal Mesh Input: Source mesh for socket location
  • Socket Name Input: Spawn location socket
  • Forward Offset: Distance in front of character to spawn
  • Damage Input: Damage amount for this projectile
  • Speed Input: Projectile travel speed
  • Gravity Input: Gravity scale for trajectory
// Projectile Spawn Logic
F_Spawn_Projectile(SkeletalMesh, SocketName, ForwardOffset, Damage, Speed) {
spawn_location = GetSocketLocation(SkeletalMesh, SocketName);
spawn_direction = GetActorRotation().ForwardVector;
offset_location = spawn_location + (spawn_direction * ForwardOffset);
SpawnActor(ProjectileClass, offset_location, GetActorRotation());
}

Control projectile spawn timing through animation notifies:

  • Notify Name: “projectile_spawn”
  • Timing Control: Spawn projectile at precise animation moment
  • Animation Integration: Add notify to all projectile-based attack animations
  • Socket: S_Right_Hand_Item
  • Speed: 2000 units for medium-speed magical projectiles
  • Scale: Standard sphere size
  • VFX: Magical impact effects
  • Socket: Muzzle (pre-existing on gun mesh)
  • Speed: 3000 units for high-velocity bullets
  • Scale: Small bullet size (adjust X/Y/Z independently)
  • Forward Offset: 5 units from muzzle
  • Socket: S_Arrow (custom socket on bow mesh)
  • Speed: 3000 units for arrow velocity
  • Scale: Elongated (X=5, Y=0.5, Z=0.5) for arrow appearance
  • Trajectory: May include slight gravity for realistic arc

Special projectile configuration for area damage:

  • Custom Rotation: Enable custom rotation input for arc trajectory
  • Gravity: Gravity scale 1 for realistic throwing arc
  • Explosion: Area damage on impact
  • Timer Detonation: Alternative to impact detonation
  • Launch Angle: X rotation 22.5 degrees for throwing arc
  • Custom Rotation: Override normal forward direction
  • Speed/Gravity Balance: Adjust for satisfying throw feel
  • Impact VFX: Spawn particle effects on hit
  • Trail Effects: Optional trail particles during flight
  • Environmental Integration: Ensure landscape generates overlap events
  • Cleanup Timer: Destroy projectiles after set duration
  • Collision Disable: Turn off collision after hit before destruction
  • Visibility: Hide projectile mesh after impact while VFX plays

Prepare projectile system for team-based games:

  • Team Variable: Expose team assignment on spawn
  • Friendly Fire: Prevent damage to same-team characters
  • Owner Exclusion: Prevent self-damage from own projectiles

The projectile system provides flexible, reusable ranged combat mechanics that integrate smoothly with animation timing and visual effects while supporting multiple projectile types and behaviors.