Notice
Recent Posts
Recent Comments
Link
«   2026/01   »
1 2 3
4 5 6 7 8 9 10
11 12 13 14 15 16 17
18 19 20 21 22 23 24
25 26 27 28 29 30 31
Tags
more
Archives
Today
Total
관리 메뉴

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);