Navigation
API > API/Runtime > API/Runtime/Engine
Structure containing information about one hit of a trace, such as point of impact and surface normal at that point.
| Name | FHitResult |
| Type | struct |
| Header File | /Engine/Source/Runtime/Engine/Classes/Engine/HitResult.h |
| Include Path | #include "Engine/HitResult.h" |
Syntax
USTRUCT (BlueprintType ,
Meta=(HasNativeBreak="/Script/Engine.GameplayStatics.BreakHitResult", HasNativeMake="/Script/Engine.GameplayStatics.MakeHitResult"))
struct FHitResult
Constructors
| Name | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|
FHitResult
(
AActor* InActor, |
Ctor for easily creating "fake" hits from limited data. | Engine/HitResult.h | |
FHitResult
(
FVector Start, |
Engine/HitResult.h | ||
FHitResult
(
ENoInit NoInit |
Engine/HitResult.h | ||
FHitResult
(
EForceInit InInit |
Engine/HitResult.h | ||
FHitResult () |
Engine/HitResult.h | ||
FHitResult
(
float InTime |
Engine/HitResult.h |
Variables
Public
| Name | Type | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|---|
| bBlockingHit | uint8 | Indicates if this hit was a result of blocking collision. | Engine/HitResult.h | |
| BoneName | FName | Name of bone we hit (for skeletal meshes). | Engine/HitResult.h | |
| bStartPenetrating | uint8 | Whether the trace started in penetration, i.e. with an initial blocking overlap. | Engine/HitResult.h | |
| Component | TWeakObjectPtr< UPrimitiveComponent > | PrimitiveComponent hit by the trace. | Engine/HitResult.h | |
| Distance | float | The distance from the TraceStart to the Location in world space. | Engine/HitResult.h | |
| ElementIndex | uint8 | Index to item that was hit, also hit primitive specific. | Engine/HitResult.h | |
| FaceIndex | int32 | Face index we hit (for complex hits with triangle meshes). | Engine/HitResult.h | |
| HitObjectHandle | FActorInstanceHandle | Handle to the object hit by the trace. | Engine/HitResult.h | |
| ImpactNormal | FVector_NetQuantizeNormal | Normal of the hit in world space, for the object that was hit by the sweep, if any. | Engine/HitResult.h | |
| ImpactPoint | FVector_NetQuantize | Location in world space of the actual contact of the trace shape (box, sphere, ray, etc) with the impacted object. | Engine/HitResult.h | |
| Item | int32 | Extra data about item that was hit (hit primitive specific). | Engine/HitResult.h | |
| Location | FVector_NetQuantize | The location in world space where the moving shape would end up against the impacted object, if there is a hit. | Engine/HitResult.h | |
| MyBoneName | FName | Name of the my bone which took part in hit event (in case of two skeletal meshes colliding). | Engine/HitResult.h |
|
| MyItem | int32 | If the hit result is from a collision this will have extra info about the item that hit the second item. | Engine/HitResult.h |
|
| Normal | FVector_NetQuantizeNormal | Normal of the hit in world space, for the object that was swept. | Engine/HitResult.h | |
| PenetrationDepth | float | If this test started in penetration (bStartPenetrating is true) and a depenetration vector can be computed, this value is the distance along Normal that will result in moving out of penetration. | Engine/HitResult.h | |
| PhysicsObject | Chaos::FPhysicsObjectHandle | PhysicsObjects hit by the query. Not exposed to blueprints for the time being | Engine/HitResult.h | |
| PhysicsObjectOwner | TWeakObjectPtr< UObject > | The object that owns the PhysicsObject. | Engine/HitResult.h | |
| PhysMaterial | TWeakObjectPtr< UPhysicalMaterial > | Physical material that was hit. | Engine/HitResult.h | |
| Time | float | 'Time' of impact along trace direction (ranging from 0.0 to 1.0) if there is a hit, indicating time between TraceStart and TraceEnd. | Engine/HitResult.h | |
| TraceEnd | FVector_NetQuantize | End location of the trace; this is NOT where the impact occurred (if any), but the furthest point in the attempted sweep. | Engine/HitResult.h | |
| TraceStart | FVector_NetQuantize | Start location of the trace. | Engine/HitResult.h |
Functions
Public
| Name | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|
AActor * GetActor() |
Utility to return the Actor that owns the Component that was hit. | Engine/HitResult.h | |
UPrimitiveComponent * GetComponent() |
Utility to return the Component that was hit. | Engine/HitResult.h | |
FActorInstanceHandle GetHitObjectHandle() |
Engine/HitResult.h | ||
bool HasValidHitObjectHandle() |
Engine/HitResult.h | ||
void Init
(
FVector Start, |
Initialize empty hit result with given time, TraceStart, and TraceEnd | Engine/HitResult.h | |
void Init () |
Initialize empty hit result with given time. | Engine/HitResult.h | |
bool IsValidBlockingHit() |
Return true if there was a blocking hit that was not caused by starting in penetration. | Engine/HitResult.h | |
bool NetSerialize
(
FArchive& Ar, |
Optimized serialize function | Engine/HitResult.h | |
void Reset
(
float InTime, |
Reset hit result while optionally saving TraceStart and TraceEnd. | Engine/HitResult.h | |
FString ToString() |
Engine/HitResult.h |
Static
| Name | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|
static FHitResult * GetFirstBlockingHit
(
TArray< FHitResult >& InHits |
Static utility function that returns the first 'blocking' hit in an array of results. | Engine/HitResult.h | |
static int32 GetNumBlockingHits
(
const TArray< FHitResult >& InHits |
Static utility function that returns the number of blocking hits in array. | Engine/HitResult.h | |
static int32 GetNumOverlapHits
(
const TArray< FHitResult >& InHits |
Static utility function that returns the number of overlapping hits in array. | Engine/HitResult.h | |
static FHitResult GetReversedHit
(
const FHitResult& Hit |
Get a copy of the HitResult with relevant information reversed. | Engine/HitResult.h |