ACharacter::LaunchCharacter
#include "GameFramework/Character.h"
Access: public
Description
Applies a velocity impulse to the character, overriding or adding to the current velocity. Used for knockback, explosive force, launch pads, and similar effects.
Signature
void LaunchCharacter(FVector LaunchVelocity, bool bXYOverride, bool bZOverride) Parameters
| Name | Type | Description | Default |
|---|---|---|---|
| LaunchVelocity | FVector | The velocity to apply to the character. | — |
| bXYOverride | bool | If true, replaces XY velocity. If false, adds to existing XY velocity. | — |
| bZOverride | bool | If true, replaces Z velocity. If false, adds to existing Z velocity. | — |
Return Type
void Caveats & Gotchas
- • This should be called on the server in multiplayer. The resulting velocity is replicated.
- • Setting bXYOverride and bZOverride to true effectively teleports the velocity to exactly LaunchVelocity.
Example
Launching the character upward C++
// Launch the character straight up at 1500 units/sec, preserving XY
MyCharacter->LaunchCharacter(FVector(0.f, 0.f, 1500.f), false, true);
// Full knockback: override all axes
MyCharacter->LaunchCharacter(KnockbackVelocity, true, true); See Also
Version History
Introduced in: 4.0
| Version | Status | Notes |
|---|---|---|
| 5.6 | stable | — |
Feedback
Was this helpful?