강의

멘토링

커뮤니티

Cộng đồng Hỏi & Đáp của Inflearn

Không có người viết

Bài viết có thông tin người viết đã bị xóa.

[Đại học Rookiss] Series phân tích mã nguồn UE5 của Haker #1 (Khung game)

Ngày 5 Tiết 3

AActor를 APhysicsVolume으로 Cast가 되는 이유

Viết

·

73

0

안녕하세요!


아래 코드는 UPrimitiveComponent의 UpdatePhysicsVolume 함수인데, 컴포넌트의 owner인 액터를 가져와서 그대로 Cast<APhysicsVolume>을 했는데,
액터가 캐릭터일 수도 있을 텐데 이게 어떻게 가능한 것인지 모르겠습니다...

감사합니다

// haker: just get the owner Actor and compare Physics Volume's priority
APhysicsVolume* V = Cast<APhysicsVolume>(OtherComponent->GetOwner());
if (V && V->Priority > BestPriority)
{
                                if (V->IsOverlapInVolume(*this))
                                {
                                    BestPriority = V->Priority;
                                    BestVolume = V;
                                }
}
unreal-engineunreal-engine5

Câu trả lời 1

0

Rookiss님의 프로필 이미지
Rookiss
Người chia sẻ kiến thức

언리얼의 Cast는 C++의 dynamic_cast와 유사합니다.
APhysicsVolume* 타입이 아니라면 애당초 nullptr이 뜹니다.

Không có người viết

Bài viết có thông tin người viết đã bị xóa.

Đặt câu hỏi