六一的部落格


关关难过关关过,前路漫漫亦灿灿。




说明

通过AActor::AttachToComponent将Actor附加到可变换组件的挂载点上, 要求已在组件上添加挂载点, 并提供以下信息

-
Actor
可变换组件
挂载规则
挂载点名称

挂载函数 AActor::AttachToComponent

AActor::AttachToComponent


可变换组件: USceneComponent及其派生类

基类
UPrimitiveComponent USceneComponent
UMeshComponent UPrimitiveComponent
USkeletalMeshComponent UMeshComponent
UStaticMeshComponent UMeshComponent

挂载规则: FAttachmentTransformRules对象


FAttachmentTransformRules


说明

UE_5.1/Engine/Source/Runtime/Engine/Classes/Engine/EngineTypes.h

如何计算附加Actor的变换属性


数据成员

  • LocationRule, RotationRule和ScaleRule

    1. 对应变换属性的三个分量
    2. 使用EAttachmentRule进行设置
  • bInWeldSimulatedBodies

    Whether to weld simulated bodies together when attaching

    不知道效果, 设为false


构造函数

  1. 对变换属性的分量应用相同规则
    1FAttachmentTransformRules(EAttachmentRule InRule, bool bInWeldSimulatedBodies)
    2    : LocationRule(InRule)
    3    , RotationRule(InRule)
    4    , ScaleRule(InRule)
    5    , bWeldSimulatedBodies(bInWeldSimulatedBodies)
    6{}
  2. 为变换属性定制规则
    1FAttachmentTransformRules(EAttachmentRule InLocationRule, EAttachmentRule InRotationRule, EAttachmentRule InScaleRule, bool bInWeldSimulatedBodies)
    2    : LocationRule(InLocationRule)
    3    , RotationRule(InRotationRule)
    4    , ScaleRule(InScaleRule)
    5    , bWeldSimulatedBodies(bInWeldSimulatedBodies)
    6{}

EAttachmentRule


说明

UE_5.1/Engine/Source/Runtime/Engine/Classes/Engine/EngineTypes.h

如何计算附件Actor的最终变换矩阵

API


枚举成员

-
SnapToTarget Snaps transform to the attach point
KeepWorld Automatically calculates the relative transform such that the attached component maintains the same world transform
KeepRelative Keeps current relative transform as the relative transform to the new parent

不知道区别, 使用SnapToTarget; 使用KeepRelative可以达到一样的效果


将Actor附加到可变换组件的挂载点



说明

通过AActor::AttachToComponent将Actor附加到可变换组件的挂载点上, 要求已在组件上添加挂载点, 并提供以下信息

-
Actor
可变换组件
挂载规则
挂载点名称

挂载函数 AActor::AttachToComponent

AActor::AttachToComponent


可变换组件: USceneComponent及其派生类

基类
UPrimitiveComponent USceneComponent
UMeshComponent UPrimitiveComponent
USkeletalMeshComponent UMeshComponent
UStaticMeshComponent UMeshComponent

挂载规则: FAttachmentTransformRules对象


FAttachmentTransformRules


说明

UE_5.1/Engine/Source/Runtime/Engine/Classes/Engine/EngineTypes.h

如何计算附加Actor的变换属性


数据成员

  • LocationRule, RotationRule和ScaleRule

    1. 对应变换属性的三个分量
    2. 使用EAttachmentRule进行设置
  • bInWeldSimulatedBodies

    Whether to weld simulated bodies together when attaching

    不知道效果, 设为false


构造函数

  1. 对变换属性的分量应用相同规则
    1FAttachmentTransformRules(EAttachmentRule InRule, bool bInWeldSimulatedBodies)
    2    : LocationRule(InRule)
    3    , RotationRule(InRule)
    4    , ScaleRule(InRule)
    5    , bWeldSimulatedBodies(bInWeldSimulatedBodies)
    6{}
  2. 为变换属性定制规则
    1FAttachmentTransformRules(EAttachmentRule InLocationRule, EAttachmentRule InRotationRule, EAttachmentRule InScaleRule, bool bInWeldSimulatedBodies)
    2    : LocationRule(InLocationRule)
    3    , RotationRule(InRotationRule)
    4    , ScaleRule(InScaleRule)
    5    , bWeldSimulatedBodies(bInWeldSimulatedBodies)
    6{}

EAttachmentRule


说明

UE_5.1/Engine/Source/Runtime/Engine/Classes/Engine/EngineTypes.h

如何计算附件Actor的最终变换矩阵

API


枚举成员

-
SnapToTarget Snaps transform to the attach point
KeepWorld Automatically calculates the relative transform such that the attached component maintains the same world transform
KeepRelative Keeps current relative transform as the relative transform to the new parent

不知道区别, 使用SnapToTarget; 使用KeepRelative可以达到一样的效果