2024-05-01
깃허브! |
---|
https://github.com/ChangJin-Lee/ARproject |
★ https://github.com/ChangJin-Lee/ToonTank |
느낀점
SetRootComponent()와 RootComponent = Target 의 차이에 대해서 조사해봤다. 멤버 함수와 멤버 변수의 차이라고 생각했는데 사용하는 방법에서도 차이가 있었다.
bool AActor::SetRootComponent(class USceneComponent* NewRootComponent)
{
/** Only components owned by this actor can be used as a its root component. */
if (ensure(NewRootComponent == nullptr || NewRootComponent->GetOwner() == this))
{
if (RootComponent != NewRootComponent)
{
Modify();
USceneComponent* OldRootComponent = RootComponent;
RootComponent = NewRootComponent;
// Notify new root first, as it probably has no delegate on it.
if (NewRootComponent)
{
NewRootComponent->NotifyIsRootComponentChanged(true);
}
if (OldRootComponent)
{
OldRootComponent->NotifyIsRootComponentChanged(false);
}
}
return true;
}
return false;
}
protected:
/** The component that defines the transform (location, rotation, scale) of this Actor in the world, all other components must be attached to this one somehow */
UPROPERTY(BlueprintGetter=K2_GetRootComponent, Category="Transformation")
TObjectPtr<USceneComponent> RootComponent;