Refactor RootMotionData into Transform to simplify code
This commit is contained in:
@@ -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()
|
||||
|
||||
@@ -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();
|
||||
|
||||
Reference in New Issue
Block a user