AActor::GetPhysicsVolume
#include "GameFramework/Actor.h"
Access: public
Specifiers: virtual
Description
Returns the APhysicsVolume that is currently affecting this actor. Every actor is always inside at least the default world physics volume.
Caveats & Gotchas
- • Returns the volume affecting the actor's root component location. If an actor's components span multiple physics volumes, only the volume at the root component's position is returned.
- • The return value is never null — if no custom physics volume is present, the world's default ADefaultPhysicsVolume is returned. Always check for specific subclasses rather than null.
Signature
ENGINE_API virtual APhysicsVolume* GetPhysicsVolume() const Return Type
APhysicsVolume* Example
Check if actor is in water C++
APhysicsVolume* Volume = GetPhysicsVolume();
if (Volume && Volume->bWaterVolume)
{
// Actor is submerged — apply buoyancy or swimming movement
} See Also
Tags
Version History
Introduced in: 4.0
| Version | Status | Notes |
|---|---|---|
| 5.6 | stable | — |
Feedback
Was this helpful?