torso not lost on scene transition

This commit is contained in:
Leon Palluch 2020-02-01 20:30:27 +01:00
parent 8a82a2833f
commit eeee538703
4 changed files with 10 additions and 7 deletions

View File

@ -6,7 +6,7 @@
[node name="Body Builder Menu" type="Spatial"]
script = ExtResource( 2 )
torsoPath = NodePath("Torso")
torsoPath = NodePath("Player")
cameraPath = NodePath("GUI/HBoxC/ViewportContainer/Viewport/Camera")
rayCastPath = NodePath("GUI/HBoxC/ViewportContainer/Viewport/MouseLook")
viewPortPath = NodePath("GUI/HBoxC/ViewportContainer/Viewport")
@ -65,7 +65,5 @@ enabled = true
collide_with_areas = true
collide_with_bodies = false
[node name="Torso" parent="." instance=ExtResource( 1 )]
[node name="Player" parent="." instance=ExtResource( 1 )]
[connection signal="pressed" from="GUI/HBoxC/VBoxC/Start" to="." method="_on_Start_pressed"]
[editable path="Torso"]

View File

@ -124,4 +124,4 @@ func delete_body_part():
func _on_Start_pressed():
PhysicsServer.area_set_param(get_viewport().find_world().get_space(), PhysicsServer.AREA_PARAM_GRAVITY, _default_grav)
emit_signal("start_fight")
emit_signal("start_fight", _torso)

View File

@ -50,8 +50,13 @@ func _switch_to_win(player_id):
_win_screen_scene.set_win_message(player_id)
func _switch_to_fighting():
func _switch_to_fighting(torso):
_body_build_scene.remove_child(torso)
torso.translation += Vector3(0, 3, 0)
torso.rotation = Vector3(0, 0, 0)
_switch_scene(_fighting_scene, "fight_scene")
_fighting_scene.add_child(torso)
func _switch_to_body_build():

View File

@ -16,7 +16,7 @@ script = ExtResource( 4 )
[node name="Arena" parent="." instance=ExtResource( 5 )]
[node name="Torso" parent="." instance=ExtResource( 3 )]
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 2, 0 )
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 17.8512, 2, 0 )
[node name="Torso2" parent="." instance=ExtResource( 3 )]
transform = Transform( -1, 0, -8.74228e-08, 0, 1, 0, 8.74228e-08, 0, -1, 0, 2, -10 )