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