관리 메뉴

Mini

[UE5] 충돌위치 찾기 location vs impactpoint 본문

UE5

[UE5] 충돌위치 찾기 location vs impactpoint

Mini_96 2023. 9. 17. 19:50

 

location : 초록구체

impactpoint : 빨간구체

FCollisionShape SPhere = FCollisionShape::MakeSphere(GrabRadius);
FHitResult HitResult;	//함수안에서 부딪힌 결과물 넣어줌
bool HasHit = GetWorld()->SweepSingleByChannel(
    HitResult, Start, End, FQuat::Identity,
    ECC_GameTraceChannel2, SPhere);

if (HasHit) {
    //파랑구체그리기
    //location : Sphere(sweep 매개변수)랑 물체랑 닿았을때, sphere의 위치
    //impactpoint : sphere랑 실제물체가 닿은 위치
    DrawDebugSphere(GetWorld(), HitResult.Location, 10, 10, FColor::Green, false, 5);
    DrawDebugSphere(GetWorld(), HitResult.ImpactPoint, 10, 10, FColor::Red, false, 5);