|
@@ -103,6 +103,19 @@ void CollisionPolygon::_add_to_collision_object(Object *p_obj) {
|
|
//co->add_shape(shape,get_transform());
|
|
//co->add_shape(shape,get_transform());
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+void CollisionPolygon::_update_xform_in_parent() {
|
|
|
|
+
|
|
|
|
+ if (shape_from >= 0 && shape_to >= 0) {
|
|
|
|
+
|
|
|
|
+ CollisionObject *co = get_parent()->cast_to<CollisionObject>();
|
|
|
|
+ if (co) {
|
|
|
|
+ for (int i = shape_from; i <= shape_to; i++) {
|
|
|
|
+ co->set_shape_transform(i, get_transform());
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+}
|
|
|
|
+
|
|
void CollisionPolygon::_update_parent() {
|
|
void CollisionPolygon::_update_parent() {
|
|
|
|
|
|
if (!can_update_body)
|
|
if (!can_update_body)
|
|
@@ -135,6 +148,10 @@ void CollisionPolygon::_notification(int p_what) {
|
|
can_update_body = get_tree()->is_editor_hint();
|
|
can_update_body = get_tree()->is_editor_hint();
|
|
set_notify_local_transform(!can_update_body);
|
|
set_notify_local_transform(!can_update_body);
|
|
|
|
|
|
|
|
+ if (!can_update_body) {
|
|
|
|
+ _update_xform_in_parent();
|
|
|
|
+ }
|
|
|
|
+
|
|
//indicator_instance = VisualServer::get_singleton()->instance_create2(indicator,get_world()->get_scenario());
|
|
//indicator_instance = VisualServer::get_singleton()->instance_create2(indicator,get_world()->get_scenario());
|
|
} break;
|
|
} break;
|
|
case NOTIFICATION_EXIT_TREE: {
|
|
case NOTIFICATION_EXIT_TREE: {
|
|
@@ -151,14 +168,8 @@ void CollisionPolygon::_notification(int p_what) {
|
|
|
|
|
|
} break;
|
|
} break;
|
|
case NOTIFICATION_LOCAL_TRANSFORM_CHANGED: {
|
|
case NOTIFICATION_LOCAL_TRANSFORM_CHANGED: {
|
|
- if (!can_update_body && shape_from >= 0 && shape_to >= 0) {
|
|
|
|
-
|
|
|
|
- CollisionObject *co = get_parent()->cast_to<CollisionObject>();
|
|
|
|
- if (co) {
|
|
|
|
- for (int i = shape_from; i <= shape_to; i++) {
|
|
|
|
- co->set_shape_transform(i, get_transform());
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
|
|
+ if (!can_update_body) {
|
|
|
|
+ _update_xform_in_parent();
|
|
}
|
|
}
|
|
|
|
|
|
} break;
|
|
} break;
|