UGameplayStatics::FindCollisionUV
#include "Kismet/GameplayStatics.h"
Access: public
Specifiers: staticUFUNCTIONBlueprintPure
Description
Returns the UV texture coordinate at the impact point of a collision hit. Returns false if UV retrieval is unsupported or not enabled.
Caveats & Gotchas
- • Requires 'Support UV From Hit Results' to be enabled in Project Settings > Physics — without it this always returns false and UV is zero.
- • Only works for static mesh and landscape surfaces; skeletal meshes do not support UV-from-hit-result and will always return false.
- • Enabling this feature stores additional UV data in the physics cook, increasing memory usage for every static mesh in the project.
Signature
static ENGINE_API bool FindCollisionUV(const struct FHitResult& Hit, int32 UVChannel, FVector2D& UV); Parameters
| Name | Type | Description | Default |
|---|---|---|---|
| Hit | const struct FHitResult& | The hit result from a collision query. | — |
| UVChannel | int32 | The UV channel index to query (0-based). | — |
| UV | FVector2D& | Output UV coordinate at the impact point. | — |
Return Type
bool Example
Sample a texture at the hit point C++
FVector2D HitUV;
if (UGameplayStatics::FindCollisionUV(Hit, 0, HitUV))
{
UE_LOG(LogTemp, Log, TEXT("Hit UV: (%f, %f)"), HitUV.X, HitUV.Y);
// Use HitUV to sample a runtime texture or drive decal placement.
} Tags
Version History
Introduced in: 4.14
| Version | Status | Notes |
|---|---|---|
| 5.6 | stable | — |
Feedback
Was this helpful?