summaryrefslogtreecommitdiffstats
path: root/scene/animation
diff options
context:
space:
mode:
authorJuan Linietsky <reduzio@gmail.com>2018-06-30 19:58:37 -0300
committerJuan Linietsky <reduzio@gmail.com>2018-06-30 19:59:16 -0300
commitb3627e29f0bbb67813fe518ad55e9509b4752e6c (patch)
tree363792aa0155d5ebb1851e924c78583e365a4b4e /scene/animation
parent3852c5f8a0b439a8c0c6e72433d6fe82e3e596de (diff)
downloadredot-engine-b3627e29f0bbb67813fe518ad55e9509b4752e6c.tar.gz
-Fixes to OBJ importer, option to disable optimization
-Fixes to script language, PlaceHolder can now get and check methods
Diffstat (limited to 'scene/animation')
-rw-r--r--scene/animation/root_motion_view.cpp19
-rw-r--r--scene/animation/root_motion_view.h4
2 files changed, 21 insertions, 2 deletions
diff --git a/scene/animation/root_motion_view.cpp b/scene/animation/root_motion_view.cpp
index 8443995720..a28c63064a 100644
--- a/scene/animation/root_motion_view.cpp
+++ b/scene/animation/root_motion_view.cpp
@@ -37,6 +37,14 @@ float RootMotionView::get_radius() const {
return radius;
}
+void RootMotionView::set_zero_y(bool p_zero_y) {
+ zero_y = p_zero_y;
+}
+
+bool RootMotionView::get_zero_y() const {
+ return zero_y;
+}
+
void RootMotionView::_notification(int p_what) {
if (p_what == NOTIFICATION_ENTER_TREE) {
@@ -77,9 +85,11 @@ void RootMotionView::_notification(int p_what) {
transform.orthonormalize(); //dont want scale, too imprecise
transform.affine_invert();
- accumulated = accumulated * transform;
+ accumulated = transform * accumulated;
accumulated.origin.x = Math::fposmod(accumulated.origin.x, cell_size);
- accumulated.origin.y = Math::fposmod(accumulated.origin.y, cell_size);
+ if (zero_y) {
+ accumulated.origin.y = 0;
+ }
accumulated.origin.z = Math::fposmod(accumulated.origin.z, cell_size);
VS::get_singleton()->immediate_clear(immediate);
@@ -142,13 +152,18 @@ void RootMotionView::_bind_methods() {
ClassDB::bind_method(D_METHOD("set_radius", "size"), &RootMotionView::set_radius);
ClassDB::bind_method(D_METHOD("get_radius"), &RootMotionView::get_radius);
+ ClassDB::bind_method(D_METHOD("set_zero_y", "enable"), &RootMotionView::set_zero_y);
+ ClassDB::bind_method(D_METHOD("get_zero_y"), &RootMotionView::get_zero_y);
+
ADD_PROPERTY(PropertyInfo(Variant::NODE_PATH, "animation_path", PROPERTY_HINT_NODE_PATH_VALID_TYPES, "AnimationTree"), "set_animation_path", "get_animation_path");
ADD_PROPERTY(PropertyInfo(Variant::COLOR, "color"), "set_color", "get_color");
ADD_PROPERTY(PropertyInfo(Variant::REAL, "cell_size", PROPERTY_HINT_RANGE, "0.1,16,0.01,or_greater"), "set_cell_size", "get_cell_size");
ADD_PROPERTY(PropertyInfo(Variant::REAL, "radius", PROPERTY_HINT_RANGE, "0.1,16,0.01,or_greater"), "set_radius", "get_radius");
+ ADD_PROPERTY(PropertyInfo(Variant::BOOL, "zero_y"), "set_zero_y", "get_zero_y");
}
RootMotionView::RootMotionView() {
+ zero_y = true;
radius = 10;
cell_size = 1;
set_process_internal(true);
diff --git a/scene/animation/root_motion_view.h b/scene/animation/root_motion_view.h
index 65e9ff480b..611183d364 100644
--- a/scene/animation/root_motion_view.h
+++ b/scene/animation/root_motion_view.h
@@ -13,6 +13,7 @@ public:
bool use_in_game;
Color color;
bool first;
+ bool zero_y;
Transform accumulated;
@@ -33,6 +34,9 @@ public:
void set_radius(float p_radius);
float get_radius() const;
+ void set_zero_y(bool p_zero_y);
+ bool get_zero_y() const;
+
virtual AABB get_aabb() const;
virtual PoolVector<Face3> get_faces(uint32_t p_usage_flags) const;