APawn::GetPhysicsVolume
#include "GameFramework/Pawn.h"
Access: public
Specifiers: virtualoverride
Description
Returns the physics volume that currently contains this pawn. Overrides `AActor::GetPhysicsVolume` to delegate to the movement component when present, which tracks the volume more accurately for moving pawns.
Caveats & Gotchas
- • When the pawn has a `UCharacterMovementComponent`, this returns the volume tracked by that component — which may lag one frame behind the actor's physical position during fast movement.
- • If the pawn has no movement component, the call falls back to `AActor::GetPhysicsVolume`, which queries the world's default physics volume. Always null-check the return value.
Signature
ENGINE_API virtual APhysicsVolume* GetPhysicsVolume() const override Return Type
APhysicsVolume* Example
Check if the pawn is underwater C++
APhysicsVolume* Vol = MyPawn->GetPhysicsVolume();
if (Vol && Vol->bWaterVolume)
{
ApplyUnderwaterEffects();
} Tags
Version History
Introduced in: 4.0
| Version | Status | Notes |
|---|---|---|
| 5.6 | stable | — |
Feedback
Was this helpful?