APawn::InFreeCam
#include "GameFramework/Pawn.h"
Access: public
Specifiers: virtual
Description
Returns true if the local PlayerController is currently viewing this Pawn through a free-cam (spectator-style camera detached from the pawn). Useful for suppressing first-person effects that look wrong in free-cam.
Caveats & Gotchas
- • Only meaningful on the local client — always returns false on a dedicated server because there is no local PlayerController.
- • Free-cam here specifically means the PlayerController's camera is detached and orbiting the pawn (e.g. after death spectating). It does not detect every custom camera mode; subclass and override if you have a non-standard camera setup.
- • The result can change mid-frame if camera transitions are being processed. Cache the result if you query it multiple times in one function.
Signature
ENGINE_API virtual bool InFreeCam() const; Return Type
bool Example
Hide first-person arms when in free-cam C++
void AMyCharacter::Tick(float DeltaTime)
{
Super::Tick(DeltaTime);
if (ArmsMesh)
{
ArmsMesh->SetVisibility(!InFreeCam());
}
} Tags
Version History
Introduced in: 4.0
| Version | Status | Notes |
|---|---|---|
| 5.6 | stable | — |
Feedback
Was this helpful?