diff options
-rw-r--r-- | doc/classes/RemoteTransform.xml | 27 | ||||
-rw-r--r-- | doc/classes/RemoteTransform2D.xml | 27 | ||||
-rw-r--r-- | modules/bullet/collision_object_bullet.cpp | 6 | ||||
-rw-r--r-- | modules/bullet/shape_bullet.cpp | 1 | ||||
-rw-r--r-- | modules/bullet/space_bullet.cpp | 1 | ||||
-rw-r--r-- | scene/2d/parallax_layer.cpp | 16 |
6 files changed, 55 insertions, 23 deletions
diff --git a/doc/classes/RemoteTransform.xml b/doc/classes/RemoteTransform.xml index 76caea1a94..fe754deea5 100644 --- a/doc/classes/RemoteTransform.xml +++ b/doc/classes/RemoteTransform.xml @@ -1,11 +1,11 @@ <?xml version="1.0" encoding="UTF-8" ?> <class name="RemoteTransform" inherits="Spatial" category="Core" version="3.0-alpha"> <brief_description> - RemoteTransform mirrors the [Transform] of another [Spatial] derived Node in the scene. + RemoteTransform leads the [Transform] of another [Spatial] derived Node in the scene. </brief_description> <description> - RemoteTransform mirrors the [Transform] of another [Spatial] derived Node (called the remote node) in the scene. - It can be set to track another Node's position, rotation and/or scale and update its own accordingly, using either global or local coordinates. + RemoteTransform leads the [Transform] of another [Spatial] derived Node (called the remote node) in the scene. + It can be set to track another Node's position, rotation and/or scale. It can update using either global or local coordinates. </description> <tutorials> </tutorials> @@ -16,30 +16,35 @@ <return type="NodePath"> </return> <description> + Returns the [NodePath] to the remote node, relative to the RemoteTransform's position in the scene. </description> </method> <method name="get_update_position" qualifiers="const"> <return type="bool"> </return> <description> + Returns if the RemoteTransform is tracking position. </description> </method> <method name="get_update_rotation" qualifiers="const"> <return type="bool"> </return> <description> + Returns if the RemoteTransform is tracking rotation. </description> </method> <method name="get_update_scale" qualifiers="const"> <return type="bool"> </return> <description> + Returns if the RemoteTransform2D is tracking scale. </description> </method> <method name="get_use_global_coordinates" qualifiers="const"> <return type="bool"> </return> <description> + Returns if the RemoteTransform is tracking using global coordinates. </description> </method> <method name="set_remote_node"> @@ -48,6 +53,7 @@ <argument index="0" name="path" type="NodePath"> </argument> <description> + Sets the [NodePath] to the remote node, relative to the RemoteTransform's position in the node scene. </description> </method> <method name="set_update_position"> @@ -56,6 +62,7 @@ <argument index="0" name="update_remote_position" type="bool"> </argument> <description> + Sets whether or not the position will be tracked. </description> </method> <method name="set_update_rotation"> @@ -64,6 +71,7 @@ <argument index="0" name="update_remote_rotation" type="bool"> </argument> <description> + Sets whether or not the rotation will be tracked. </description> </method> <method name="set_update_scale"> @@ -72,6 +80,7 @@ <argument index="0" name="update_remote_scale" type="bool"> </argument> <description> + Sets whether or not the scale will be tracked. </description> </method> <method name="set_use_global_coordinates"> @@ -80,21 +89,25 @@ <argument index="0" name="use_global_coordinates" type="bool"> </argument> <description> + Set whether or not to use global coordinates for tracking. + + If [code]true[/code], RemoteTransform will track using global coordinates, while if it's + [code]false[/code] it will track using local coordinates. </description> </method> </methods> <members> <member name="remote_path" type="NodePath" setter="set_remote_node" getter="get_remote_node"> - The remote node's [NodePath]. + The [NodePath] to the remote node, relative to the RemoteTransform's position in the scene. </member> <member name="update_position" type="bool" setter="set_update_position" getter="get_update_position"> - If [code]true[/code] the remote node's position is mirrored. + If [code]true[/code] the remote node's position is tracked. Default value: [code]true[/code]. </member> <member name="update_rotation" type="bool" setter="set_update_rotation" getter="get_update_rotation"> - If [code]true[/code] the remote node's rotation is mirrored. + If [code]true[/code] the remote node's rotation is tracked. Default value: [code]true[/code]. </member> <member name="update_scale" type="bool" setter="set_update_scale" getter="get_update_scale"> - If [code]true[/code] the remote node's scale is mirrored. + If [code]true[/code] the remote node's scale is tracked. Default value: [code]true[/code]. </member> <member name="use_global_coordinates" type="bool" setter="set_use_global_coordinates" getter="get_use_global_coordinates"> If [code]true[/code] global coordinates are used. If [code]false[/code] local coordinates are used. Default value: [code]true[/code]. diff --git a/doc/classes/RemoteTransform2D.xml b/doc/classes/RemoteTransform2D.xml index d6dcde5742..671bb11774 100644 --- a/doc/classes/RemoteTransform2D.xml +++ b/doc/classes/RemoteTransform2D.xml @@ -1,11 +1,11 @@ <?xml version="1.0" encoding="UTF-8" ?> <class name="RemoteTransform2D" inherits="Node2D" category="Core" version="3.0-alpha"> <brief_description> - RemoteTransform2D mirrors the [Transform2D] of another [CanvasItem] derived Node in the scene. + RemoteTransform2D leads the [Transform2D] of another [CanvasItem] derived Node in the scene. </brief_description> <description> - RemoteTransform2D mirrors the [Transform2D] of another [CanvasItem] derived Node (called the remote node) in the scene. - It can be set to track another Node's position, rotation and/or and update its own accordingly, using either global or local coordinates. + RemoteTransform2D leads the [Transform2D] of another [CanvasItem] derived Node (called the remote node) in the scene. + It can be set to track another Node's position, rotation and/or scale. It can update using either global or local coordinates. </description> <tutorials> </tutorials> @@ -16,30 +16,35 @@ <return type="NodePath"> </return> <description> + Returns the [NodePath] to the remote node, relative to the RemoteTransform2D's position in the scene. </description> </method> <method name="get_update_position" qualifiers="const"> <return type="bool"> </return> <description> + Returns if the RemoteTransform2D is tracking position. </description> </method> <method name="get_update_rotation" qualifiers="const"> <return type="bool"> </return> <description> + Returns if the RemoteTransform2D is tracking rotation. </description> </method> <method name="get_update_scale" qualifiers="const"> <return type="bool"> </return> <description> + Returns if the RemoteTransform2D is tracking scale. </description> </method> <method name="get_use_global_coordinates" qualifiers="const"> <return type="bool"> </return> <description> + Returns if the RemoteTransform2D is tracking using global coordinates. </description> </method> <method name="set_remote_node"> @@ -48,6 +53,7 @@ <argument index="0" name="path" type="NodePath"> </argument> <description> + Sets the path to the remote node, relative to the RemoteTransform2D's position in the node scene. </description> </method> <method name="set_update_position"> @@ -56,6 +62,7 @@ <argument index="0" name="update_remote_position" type="bool"> </argument> <description> + Sets whether or not the position will be tracked. </description> </method> <method name="set_update_rotation"> @@ -64,6 +71,7 @@ <argument index="0" name="update_remote_rotation" type="bool"> </argument> <description> + Sets whether or not the rotation will be tracked. </description> </method> <method name="set_update_scale"> @@ -72,6 +80,7 @@ <argument index="0" name="update_remote_scale" type="bool"> </argument> <description> + Sets whether or not the scale will be tracked. </description> </method> <method name="set_use_global_coordinates"> @@ -80,21 +89,25 @@ <argument index="0" name="use_global_coordinates" type="bool"> </argument> <description> + Set whether or not to use global coordinates for tracking. + + If [code]true[/code], RemoteTransform2D will track using global coordinates, while if it's + [code]false[/code] it will track using local coordinates. </description> </method> </methods> <members> <member name="remote_path" type="NodePath" setter="set_remote_node" getter="get_remote_node"> - The remote node's [NodePath]. + The [NodePath] to the remote node, relative to the RemoteTransform2D's position in the scene. </member> <member name="update_position" type="bool" setter="set_update_position" getter="get_update_position"> - If [code]true[/code] the remote node's position is mirrored. + If [code]true[/code] the remote node's position is tracked. Default value: [code]true[/code]. </member> <member name="update_rotation" type="bool" setter="set_update_rotation" getter="get_update_rotation"> - If [code]true[/code] the remote node's rotation is mirrored. + If [code]true[/code] the remote node's rotation is tracked. Default value: [code]true[/code]. </member> <member name="update_scale" type="bool" setter="set_update_scale" getter="get_update_scale"> - If [code]true[/code] the remote node's scale is mirrored. + If [code]true[/code] the remote node's scale is tracked. Default value: [code]true[/code]. </member> <member name="use_global_coordinates" type="bool" setter="set_use_global_coordinates" getter="get_use_global_coordinates"> If [code]true[/code] global coordinates are used. If [code]false[/code] local coordinates are used. Default value: [code]true[/code]. diff --git a/modules/bullet/collision_object_bullet.cpp b/modules/bullet/collision_object_bullet.cpp index 91a049b1f3..5e878b0ee4 100644 --- a/modules/bullet/collision_object_bullet.cpp +++ b/modules/bullet/collision_object_bullet.cpp @@ -285,10 +285,10 @@ void RigidCollisionObjectBullet::on_shapes_changed() { const int size = shapes.size(); for (i = 0; i < size; ++i) { shpWrapper = &shapes[i]; - if (!shpWrapper->bt_shape) { - shpWrapper->bt_shape = shpWrapper->shape->create_bt_shape(); - } if (shpWrapper->active) { + if (!shpWrapper->bt_shape) { + shpWrapper->bt_shape = shpWrapper->shape->create_bt_shape(); + } compoundShape->addChildShape(shpWrapper->transform, shpWrapper->bt_shape); } else { compoundShape->addChildShape(shpWrapper->transform, BulletPhysicsServer::get_empty_shape()); diff --git a/modules/bullet/shape_bullet.cpp b/modules/bullet/shape_bullet.cpp index 49150484d9..f51af93a31 100644 --- a/modules/bullet/shape_bullet.cpp +++ b/modules/bullet/shape_bullet.cpp @@ -45,6 +45,7 @@ ShapeBullet::~ShapeBullet() {} btCollisionShape *ShapeBullet::prepare(btCollisionShape *p_btShape) const { p_btShape->setUserPointer(const_cast<ShapeBullet *>(this)); + p_btShape->setMargin(0.); return p_btShape; } diff --git a/modules/bullet/space_bullet.cpp b/modules/bullet/space_bullet.cpp index c82a1d1668..d8c8cab17a 100644 --- a/modules/bullet/space_bullet.cpp +++ b/modules/bullet/space_bullet.cpp @@ -467,6 +467,7 @@ void SpaceBullet::add_rigid_body(RigidBodyBullet *p_body) { dynamicsWorld->addCollisionObject(p_body->get_bt_rigid_body(), p_body->get_collision_layer(), p_body->get_collision_mask()); } else { dynamicsWorld->addRigidBody(p_body->get_bt_rigid_body(), p_body->get_collision_layer(), p_body->get_collision_mask()); + p_body->scratch_space_override_modificator(); } } diff --git a/scene/2d/parallax_layer.cpp b/scene/2d/parallax_layer.cpp index 4a69841975..9da27caa4c 100644 --- a/scene/2d/parallax_layer.cpp +++ b/scene/2d/parallax_layer.cpp @@ -73,7 +73,8 @@ void ParallaxLayer::_update_mirroring() { RID c = pb->get_world_2d()->get_canvas(); RID ci = get_canvas_item(); - VisualServer::get_singleton()->canvas_set_item_mirroring(c, ci, mirroring); + Point2 mirrorScale = mirroring * get_scale(); + VisualServer::get_singleton()->canvas_set_item_mirroring(c, ci, mirrorScale); } } @@ -116,18 +117,21 @@ void ParallaxLayer::set_base_offset_and_scale(const Point2 &p_offset, float p_sc Point2 new_ofs = (screen_offset + (p_offset - screen_offset) * motion_scale) + motion_offset * p_scale + orig_offset * p_scale; - Vector2 mirror = Vector2(1, 1); - if (mirroring.x) { - mirror.x = -1; + double den = mirroring.x * p_scale; + double before = new_ofs.x; + new_ofs.x -= den * ceil(new_ofs.x / den); } if (mirroring.y) { - mirror.y = -1; + double den = mirroring.y * p_scale; + new_ofs.y -= den * ceil(new_ofs.y / den); } set_position(new_ofs); - set_scale(mirror * p_scale * orig_scale); + set_scale(Vector2(1, 1) * p_scale * orig_scale); + + _update_mirroring(); } String ParallaxLayer::get_configuration_warning() const { |