UGameplayStatics::MakeHitResult

Create a HitResult struct

Windows
MacOS
Linux

References

Module

Engine

Header

/Engine/Source/Runtime/Engine/Classes/Kismet/GameplayStatics.h

Include

#include "Kismet/GameplayStatics.h"

Source

/Engine/Source/Runtime/Engine/Private/GameplayStatics.cpp

Syntax

static FHitResult MakeHitResult
(
    bool bBlockingHit,
    bool bInitialOverlap,
    float Time,
    float Distance,
    FVector Location,
    FVector ImpactPoint,
    FVector Normal,
    FVector ImpactNormal,
    class UPhysicalMaterial * PhysMat,
    class AActor * HitActor,
    class UPrimitiveComponent * HitComponent,
    FName HitBoneName,
    int32 HitItem,
    int32 FaceIndex,
    FVector TraceStart,
    FVector TraceEnd
)

Remarks

Create a HitResult struct

Parameters

Parameter

Description

Hit

The source HitResult.

bBlockingHit

True if there was a blocking hit, false otherwise.

bInitialOverlap

True if the hit started in an initial overlap. In this case some other values should be interpreted differently. Time will be 0, ImpactPoint will equal Location, and normals will be equal and indicate a depenetration vector.

Time

'Time' of impact along trace direction ranging from [0.0 to 1.0) if there is a hit, indicating time between start and end. Equals 1.0 if there is no hit.

Distance

The distance from the TraceStart to the Location in world space. This value is 0 if there was an initial overlap (trace started inside another colliding object).

Location

Location of the hit in world space. If this was a swept shape test, this is the location where we can place the shape in the world where it will not penetrate.

Normal

Normal of the hit in world space, for the object that was swept (e.g. for a sphere trace this points towards the sphere's center). Equal to ImpactNormal for line tests.

ImpactPoint

Location of the actual contact point of the trace shape with the surface of the hit object. Equal to Location in the case of an initial overlap.

ImpactNormal

Normal of the hit in world space, for the object that was hit by the sweep.

PhysMat

Physical material that was hit. Must set bReturnPhysicalMaterial to true in the query params for this to be returned.

HitActor

Actor hit by the trace.

HitComponent

PrimitiveComponent hit by the trace.

HitBoneName

Name of the bone hit (valid only if we hit a skeletal mesh).

HitItem

Primitive-specific data recording which item in the primitive was hit

FaceIndex

If colliding with trimesh or landscape, index of face that was hit.

Select Skin
Light
Dark

Welcome to the new Unreal Engine 4 Documentation site!

We're working on lots of new features including a feedback system so you can tell us how we are doing. It's not quite ready for use in the wild yet, so head over to the Documentation Feedback forum to tell us about this page or call out any issues you are encountering in the meantime.

We'll be sure to let you know when the new system is up and running.

Post Feedback