Refactor RootMotionData into Transform to simplify code

This commit is contained in:
Wojtek Figat
2023-05-04 14:18:12 +02:00
parent 2b2b4f6b6f
commit a889d888ff
7 changed files with 31 additions and 137 deletions

View File

@@ -419,10 +419,10 @@ bool AnimatedModel::IsPlayingSlotAnimation(const StringView& slotName, Animation
return false;
}
void AnimatedModel::ApplyRootMotion(const RootMotionData& rootMotionDelta)
void AnimatedModel::ApplyRootMotion(const Transform& rootMotionDelta)
{
// Skip if no motion
if (rootMotionDelta.Translation.IsZero() && rootMotionDelta.Rotation.IsIdentity())
if (rootMotionDelta.Translation.IsZero() && rootMotionDelta.Orientation.IsIdentity())
return;
// Transform translation from actor space into world space
@@ -430,7 +430,7 @@ void AnimatedModel::ApplyRootMotion(const RootMotionData& rootMotionDelta)
// Apply movement
Actor* target = RootMotionTarget ? RootMotionTarget.Get() : this;
target->AddMovement(translation, rootMotionDelta.Rotation);
target->AddMovement(translation, rootMotionDelta.Orientation);
}
void AnimatedModel::SyncParameters()

View File

@@ -344,7 +344,7 @@ public:
API_FUNCTION() bool IsPlayingSlotAnimation(const StringView& slotName, Animation* anim);
private:
void ApplyRootMotion(const RootMotionData& rootMotionDelta);
void ApplyRootMotion(const Transform& rootMotionDelta);
void SyncParameters();
void Update();