summaryrefslogtreecommitdiff
path: root/scene/3d
diff options
context:
space:
mode:
authorBojidar Marinov <bojidar.marinov.bg@gmail.com>2016-04-06 17:14:38 +0300
committerBojidar Marinov <bojidar.marinov.bg@gmail.com>2016-04-06 17:14:38 +0300
commit6dcd1354c2e0c489eea9cf111ddbf11804c39c4b (patch)
tree62f8c5c30cdb109c1a34a8d6719136ae867dd7c8 /scene/3d
parent646e0897829d7baf4b982c59d4bddade85199665 (diff)
Add a `sleeping_state_changed` signal to RigidBody and RigidBody2D classes
Closes #3911
Diffstat (limited to 'scene/3d')
-rw-r--r--scene/3d/physics_body.cpp6
1 files changed, 5 insertions, 1 deletions
diff --git a/scene/3d/physics_body.cpp b/scene/3d/physics_body.cpp
index 1a2665b6ad..bc637eed44 100644
--- a/scene/3d/physics_body.cpp
+++ b/scene/3d/physics_body.cpp
@@ -419,7 +419,10 @@ void RigidBody::_direct_state_changed(Object *p_state) {
set_global_transform(state->get_transform());
linear_velocity=state->get_linear_velocity();
angular_velocity=state->get_angular_velocity();
- sleeping=state->is_sleeping();
+ if(sleeping!=state->is_sleeping()) {
+ sleeping=state->is_sleeping();
+ emit_signal(SceneStringNames::get_singleton()->sleeping_state_changed);
+ }
if (get_script_instance())
get_script_instance()->call("_integrate_forces",state);
set_ignore_transform_notification(false);
@@ -811,6 +814,7 @@ void RigidBody::_bind_methods() {
ADD_SIGNAL( MethodInfo("body_exit_shape",PropertyInfo(Variant::INT,"body_id"),PropertyInfo(Variant::OBJECT,"body"),PropertyInfo(Variant::INT,"body_shape"),PropertyInfo(Variant::INT,"local_shape")));
ADD_SIGNAL( MethodInfo("body_enter",PropertyInfo(Variant::OBJECT,"body")));
ADD_SIGNAL( MethodInfo("body_exit",PropertyInfo(Variant::OBJECT,"body")));
+ ADD_SIGNAL( MethodInfo("sleeping_state_changed"));
BIND_CONSTANT( MODE_STATIC );
BIND_CONSTANT( MODE_KINEMATIC );