Fix bug with gravity being lost after menu
This commit is contained in:
parent
1858ca6288
commit
14b60c1e02
@ -25,8 +25,6 @@ signal start_fight()
|
|||||||
|
|
||||||
# Called when the node enters the scene tree for the first time.
|
# Called when the node enters the scene tree for the first time.
|
||||||
func _ready():
|
func _ready():
|
||||||
_default_grav = PhysicsServer.area_get_param(get_viewport().find_world().get_space(), PhysicsServer.AREA_PARAM_GRAVITY)
|
|
||||||
PhysicsServer.area_set_param(get_viewport().find_world().get_space(), PhysicsServer.AREA_PARAM_GRAVITY, 0)
|
|
||||||
_torso = get_node(torsoPath) as RigidBody
|
_torso = get_node(torsoPath) as RigidBody
|
||||||
_camera = get_node(cameraPath) as Camera
|
_camera = get_node(cameraPath) as Camera
|
||||||
_rayCast = get_node(rayCastPath) as RayCast
|
_rayCast = get_node(rayCastPath) as RayCast
|
||||||
@ -34,6 +32,9 @@ func _ready():
|
|||||||
|
|
||||||
|
|
||||||
func _process(delta):
|
func _process(delta):
|
||||||
|
# TODO: Would be nicer to just disable gravity, but then it can't be re-enabled...
|
||||||
|
_torso.translation = Vector3.ZERO
|
||||||
|
|
||||||
if _viewRot:
|
if _viewRot:
|
||||||
var mouse_pos = get_viewport().get_mouse_position()
|
var mouse_pos = get_viewport().get_mouse_position()
|
||||||
|
|
||||||
@ -122,6 +123,4 @@ func delete_body_part():
|
|||||||
|
|
||||||
|
|
||||||
func _on_Start_pressed():
|
func _on_Start_pressed():
|
||||||
PhysicsServer.area_set_param(get_viewport().find_world().get_space(), PhysicsServer.AREA_PARAM_GRAVITY, _default_grav)
|
|
||||||
|
|
||||||
emit_signal("start_fight", _torso)
|
emit_signal("start_fight", _torso)
|
||||||
|
@ -52,12 +52,17 @@ func _switch_to_win(player_id):
|
|||||||
|
|
||||||
func _switch_to_fighting(torso):
|
func _switch_to_fighting(torso):
|
||||||
_body_build_scene.remove_child(torso)
|
_body_build_scene.remove_child(torso)
|
||||||
|
torso.global_transform.origin = Vector3.ZERO
|
||||||
torso.translation += Vector3(0, 3, 0)
|
torso.translation += Vector3(0, 3, 0)
|
||||||
torso.rotation = Vector3(0, 0, 0)
|
torso.rotation = Vector3.ZERO
|
||||||
_switch_scene(_fighting_scene, "fight_scene")
|
_switch_scene(_fighting_scene, "fight_scene")
|
||||||
|
|
||||||
_fighting_scene.add_child(torso)
|
_fighting_scene.add_child(torso)
|
||||||
|
|
||||||
|
torso.axis_lock_linear_x = false
|
||||||
|
torso.axis_lock_linear_y = false
|
||||||
|
torso.axis_lock_linear_z = false
|
||||||
|
|
||||||
|
|
||||||
func _switch_to_body_build():
|
func _switch_to_body_build():
|
||||||
_switch_scene(_body_build_scene, "body_build")
|
_switch_scene(_body_build_scene, "body_build")
|
||||||
|
@ -4,5 +4,5 @@ var bodyparts : Dictionary
|
|||||||
|
|
||||||
# Called when the node enters the scene tree for the first time.
|
# Called when the node enters the scene tree for the first time.
|
||||||
func _ready():
|
func _ready():
|
||||||
bodyparts["Arm"] = load("res://BodyParts/Arm.tscn")
|
bodyparts["Human Arm"] = load("res://BodyParts/HumanArm.tscn")
|
||||||
bodyparts["Humanleg"] = load("res://BodyParts/HumanLeg.tscn")
|
bodyparts["Human Leg"] = load("res://BodyParts/HumanLeg.tscn")
|
||||||
|
Loading…
x
Reference in New Issue
Block a user