UPrimitiveComponent
#include "Components/PrimitiveComponent.h" Description
The base class for all components that have a visual representation and can interact with the physics and collision systems. Extends USceneComponent with rendering, collision, and physics capabilities.
Caveats & Gotchas
- • Collision and physics settings (simulation, collision profiles, responses) are on UPrimitiveComponent, not on USceneComponent. If you're looking for SetSimulatePhysics or SetCollisionEnabled, they are here.
- • Overlap and hit events are only fired when both the component's collision is enabled AND the actor has overlap/hit generation enabled (bGenerateOverlapEvents / simulation for hit). Both sides of the interaction must have compatible settings.
- • Physics simulation is incompatible with attachment in most cases — simulating a component while attached to another can produce jitter or incorrect behaviour. Detach before enabling physics simulation at runtime.
Example
Configure collision in BeginPlay C++
void AMyActor::BeginPlay()
{
Super::BeginPlay();
if (UPrimitiveComponent* Prim = Cast<UPrimitiveComponent>(GetRootComponent()))
{
Prim->SetCollisionProfileName(TEXT("BlockAllDynamic"));
Prim->OnComponentBeginOverlap.AddDynamic(this, &AMyActor::OnOverlap);
}
} Functions (8)
Collision 4 ▼
| Access | Type | Name |
|---|---|---|
| public | function | UPrimitiveComponent::SetCollisionEnabled |
| public | function | UPrimitiveComponent::SetCollisionProfileName |
| public | function | UPrimitiveComponent::SetCollisionResponseToAllChannels |
| public | function | UPrimitiveComponent::SetCollisionResponseToChannel |
Utility 1 ▼
| Access | Type | Name |
|---|---|---|
| public | function | UPrimitiveComponent::GetBodyInstance |
Physics 3 ▼
| Access | Type | Name |
|---|---|---|
| public | function | UPrimitiveComponent::AddForce |
| public | function | UPrimitiveComponent::AddImpulse |
| public | function | UPrimitiveComponent::SetSimulatePhysics |
Properties
| Access | Type | Name |
|---|---|---|
| public | property | UPrimitiveComponent::OnComponentBeginOverlap |
| public | property | UPrimitiveComponent::OnComponentEndOverlap |
| public | property | UPrimitiveComponent::OnComponentHit |
Events & Delegates
See Also
Tags
Version History
Introduced in: unknown
| Version | Status | Notes |
|---|---|---|
| 5.6 | stable | — |
Feedback
Was this helpful?