|
@@ -43,14 +43,23 @@ void USpineBoneFollowerComponent::BeginPlay () {
|
|
void USpineBoneFollowerComponent::TickComponent ( float DeltaTime, ELevelTick TickType, FActorComponentTickFunction* ThisTickFunction ) {
|
|
void USpineBoneFollowerComponent::TickComponent ( float DeltaTime, ELevelTick TickType, FActorComponentTickFunction* ThisTickFunction ) {
|
|
Super::TickComponent( DeltaTime, TickType, ThisTickFunction );
|
|
Super::TickComponent( DeltaTime, TickType, ThisTickFunction );
|
|
|
|
|
|
- AActor* owner = GetOwner();
|
|
|
|
- if (Target && owner) {
|
|
|
|
|
|
+ if (Target) {
|
|
USpineSkeletonComponent* skeleton = static_cast<USpineSkeletonComponent*>(Target->GetComponentByClass(USpineSkeletonComponent::StaticClass()));
|
|
USpineSkeletonComponent* skeleton = static_cast<USpineSkeletonComponent*>(Target->GetComponentByClass(USpineSkeletonComponent::StaticClass()));
|
|
if (skeleton) {
|
|
if (skeleton) {
|
|
FTransform transform = skeleton->GetBoneWorldTransform(BoneName);
|
|
FTransform transform = skeleton->GetBoneWorldTransform(BoneName);
|
|
- if (UsePosition) owner->SetActorLocation(transform.GetLocation());
|
|
|
|
- if (UseRotation) owner->SetActorRotation(transform.GetRotation());
|
|
|
|
- if (UseScale) owner->SetActorScale3D(transform.GetScale3D());
|
|
|
|
|
|
+ if (UseComponentTransform) {
|
|
|
|
+ if (UsePosition) SetWorldLocation(transform.GetLocation());
|
|
|
|
+ if (UseRotation) SetWorldRotation(transform.GetRotation());
|
|
|
|
+ if (UseScale) SetWorldScale3D(transform.GetScale3D());
|
|
|
|
+ }
|
|
|
|
+ else {
|
|
|
|
+ AActor* owner = GetOwner();
|
|
|
|
+ if (owner) {
|
|
|
|
+ if (UsePosition) owner->SetActorLocation(transform.GetLocation());
|
|
|
|
+ if (UseRotation) owner->SetActorRotation(transform.GetRotation());
|
|
|
|
+ if (UseScale) owner->SetActorScale3D(transform.GetScale3D());
|
|
|
|
+ }
|
|
|
|
+ }
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|