SetupAttachment:
void SetupAttachment
(
USceneComponent * InParent,
FName InSocketName
)
- 通常在构造函数中、以及处理尚未注册的组件时调用。
AttachToComponent:
void AttachToComponent
(
USceneComponent * Parent,
const FAttachmentTransformRules & AttachmentRules,
FName SocketName
)
- 立即将场景组件附加到另一个组件,通常在游戏进行中调用。
- 允许Actor彼此之间进行附加,方法是将一个Actor的根组件附加到属于另一个Actor的组件。
FAttachmentTransformRules:
- KeepRelativeTransform(保持两个物体之间的相对位置不变)
- KeepWorldTransform(保持连个物体在世界的位置不变)
- SnapToTargetNotIncludingScale(保持物体的缩放对齐到目标上)
- SnapToTargetIncludingScale(随目标的缩放)
- 原文链接:附加 - CodeWithMe - 博客园 (cnblogs.com)