diff --git a/Player.gd b/Player.gd index 80ee7ee..a263c5d 100644 --- a/Player.gd +++ b/Player.gd @@ -53,9 +53,13 @@ func gravity(): if not is_on_floor(): self.velocity.y -= GRAVITY -func get_closest_point(A: Vector3, B: Vector3): +func get_closest_point(_A: Vector3, _B: Vector3): + var A = transform.inverse().xform(_A) + var B = transform.inverse().xform(_B) + var diff = B - A - return A - (A.dot(diff) * diff) / (diff.length_squared()) + var result = A - (A.dot(diff) * diff) / (diff.length_squared()) + return result.xform(transform) remote func walk(direction: Vector2): diff --git a/Player.tscn b/Player.tscn index 1c205ea..a0c71e1 100644 --- a/Player.tscn +++ b/Player.tscn @@ -76,9 +76,9 @@ anchor_top = 0.5 anchor_right = 0.5 anchor_bottom = 0.5 margin_left = -511.401 -margin_top = -301.225 +margin_top = -300.757 margin_right = 512.599 -margin_bottom = 298.775 +margin_bottom = 299.243 __meta__ = { "_edit_use_anchors_": false } @@ -149,7 +149,6 @@ margin_top = -1.0 margin_right = 16.0 margin_bottom = 1.0 rect_rotation = 45.3067 -rect_scale = Vector2( 1, 0.5 ) rect_pivot_offset = Vector2( -8, 1 ) __meta__ = { "_edit_use_anchors_": false @@ -161,7 +160,6 @@ margin_top = -1.0 margin_right = 16.0 margin_bottom = 1.0 rect_rotation = 135.307 -rect_scale = Vector2( 1, 0.5 ) rect_pivot_offset = Vector2( -8, 1 ) __meta__ = { "_edit_use_anchors_": false @@ -173,7 +171,6 @@ margin_top = -1.0 margin_right = 16.0 margin_bottom = 1.0 rect_rotation = 225.306 -rect_scale = Vector2( 1, 0.5 ) rect_pivot_offset = Vector2( -8, 1 ) __meta__ = { "_edit_use_anchors_": false @@ -185,7 +182,6 @@ margin_top = -1.0 margin_right = 16.0 margin_bottom = 1.0 rect_rotation = -44.6931 -rect_scale = Vector2( 1, 0.5 ) rect_pivot_offset = Vector2( -8, 1 ) __meta__ = { "_edit_use_anchors_": false