Skip to content

Projectiles C++ API

Class: ABaseProjectileSource/LesDeuxPelos/Public/Projectiles/BaseProjectile.h
Inherits: AActor

Overview

A projectile is an Actor spawned by a Passive. It moves via UProjectileMovementComponent, handles collision via USphereComponent, and applies damage and buffs on hit.

Components

ComponentTypeDescription
ArrowComponentUArrowComponentEditor-only forward direction indicator.
ProjectileMeshUStaticMeshComponentVisual mesh. Set No Collision on this component — use CollisionComponent for hit detection.
CollisionComponentUSphereComponentCollision sphere. Enable Overlap events on the relevant channels.
ProjectileMovementComponentUProjectileMovementComponentHandles velocity, homing, gravity.

Properties

Movement

PropertyTypeDescription
InitialSpeedfloatInitial speed (units/s). Set to 0 when parented to owner.

Level-based arrays

One entry per upgrade level (levels 1–5, 0-indexed).

PropertyTypeDescription
OnHitDamageTArray<int>Damage per hit per level.
RangeTArray<float>Max travel distance before auto-destroy. Empty = infinite.
DurationBeforeDestroyTArray<float>Lifetime in seconds. Empty = no time limit.

Hit behavior

PropertyTypeDefaultDescription
DestroyOnHitbooltrueDestroy the projectile on first overlap.
SpawnedActorsOnHitTArray<TSubclassOf<AActor>>Actors to spawn at hit location (per level).

Buffs on hit

PropertyTypeDefaultDescription
ApplyBuffsOnHitboolfalseEnable buff application on hit.
OnHitBuffsTArray<FBuffArray>Array of buff lists per level. FBuffArray wraps TArray<TSubclassOf<UBaseBuff>>.

Runtime state (read-only)

FieldTypeDescription
SourcePassiveTObjectPtr<UBasePassive>The passive that spawned this projectile.
HomingTargetActorTObjectPtr<ALesDeuxPelosCharacter>Active homing target.
ProjectileLevelintLevel set by the spawning passive.

Blueprint events

EventDescription
OnHitEffect(OtherActor)BlueprintImplementableEvent — override for visual/sound effects on hit. Do not destroy here, C++ handles it.

Methods

MethodAccessDescription
DestroyProjectile()BlueprintCallableManually destroy the projectile.
SetSourcePassive(InSourcePassive)publicCalled by the spawning passive at creation.
NotifyActorBeginOverlap(OtherActor)protected virtualHandles damage, buff application, and destruction on overlap.

Structs

FBuffArray

cpp
USTRUCT(BlueprintType)
struct FBuffArray {
    UPROPERTY(EditAnywhere, BlueprintReadWrite)
    TArray<TSubclassOf<UBaseBuff>> Buffs;
};

Used to represent a list of buffs for one level in OnHitBuffs.

Blueprint usage

Create a Blueprint child of ABaseProjectile. See Create a Projectile.