summaryrefslogtreecommitdiff
path: root/scene/animation/animation_tree.h
diff options
context:
space:
mode:
authorRémi Verschelde <rverschelde@gmail.com>2023-02-09 23:43:08 +0100
committerRémi Verschelde <rverschelde@gmail.com>2023-02-09 23:43:08 +0100
commit929ee61170ec4d431d6d2cfeddccdec2a59a11b7 (patch)
treea566a042a4dcb5f410f5a08bb2f92fc4645a1bf4 /scene/animation/animation_tree.h
parent1a5f28df20523e31854217138a46f188b6e4f668 (diff)
parent7b18ad7d9825ec425375f6e46d031cfc79660453 (diff)
Merge pull request #72931 from TokageItLab/improve-root-motion-for-rot-and-pos
Add root motion accumulator to fix broken RootMotionView
Diffstat (limited to 'scene/animation/animation_tree.h')
-rw-r--r--scene/animation/animation_tree.h14
1 files changed, 14 insertions, 0 deletions
diff --git a/scene/animation/animation_tree.h b/scene/animation/animation_tree.h
index 0540add85b..c68cae56ea 100644
--- a/scene/animation/animation_tree.h
+++ b/scene/animation/animation_tree.h
@@ -228,6 +228,12 @@ private:
}
};
+ struct RootMotionCache {
+ Vector3 loc = Vector3(0, 0, 0);
+ Quaternion rot = Quaternion(0, 0, 0, 1);
+ Vector3 scale = Vector3(1, 1, 1);
+ };
+
struct TrackCacheBlendShape : public TrackCache {
MeshInstance3D *mesh_3d = nullptr;
float init_value = 0;
@@ -294,6 +300,7 @@ private:
}
};
+ RootMotionCache root_motion_cache;
HashMap<NodePath, TrackCache *> track_cache;
HashSet<TrackCache *> playing_caches;
Vector<Node *> playing_audio_stream_players;
@@ -327,6 +334,9 @@ private:
Vector3 root_motion_position = Vector3(0, 0, 0);
Quaternion root_motion_rotation = Quaternion(0, 0, 0, 1);
Vector3 root_motion_scale = Vector3(0, 0, 0);
+ Vector3 root_motion_position_accumulator = Vector3(0, 0, 0);
+ Quaternion root_motion_rotation_accumulator = Quaternion(0, 0, 0, 1);
+ Vector3 root_motion_scale_accumulator = Vector3(1, 1, 1);
friend class AnimationNode;
bool properties_dirty = true;
@@ -394,6 +404,10 @@ public:
Quaternion get_root_motion_rotation() const;
Vector3 get_root_motion_scale() const;
+ Vector3 get_root_motion_position_accumulator() const;
+ Quaternion get_root_motion_rotation_accumulator() const;
+ Vector3 get_root_motion_scale_accumulator() const;
+
real_t get_connection_activity(const StringName &p_path, int p_connection) const;
void advance(double p_time);