save changes
This commit is contained in:
parent
d751e1373b
commit
7bf0b39d60
@ -52,13 +52,12 @@ func _input(event):
|
|||||||
|
|
||||||
func _physics_process(delta: float) -> void:
|
func _physics_process(delta: float) -> void:
|
||||||
if current_ship != null:
|
if current_ship != null:
|
||||||
if is_piloting: #if we are piloting a ship
|
if is_piloting:
|
||||||
global_transform.basis = current_ship.global_transform.basis
|
# global_transform.basis = current_ship.global_transform.basis
|
||||||
global_rotation.y = current_ship.global_rotation.y
|
global_rotation.y = current_ship.global_rotation.y
|
||||||
|
|
||||||
else: #if we are NOT piloting a ship
|
|
||||||
velocity = walk(delta) + _gravity(delta) + _jump(delta)
|
velocity = walk(delta) + _gravity(delta) + _jump(delta)
|
||||||
global_rotation.y = current_ship.global_rotation.y
|
else:
|
||||||
|
velocity = walk(delta) + _gravity(delta) + _jump(delta)
|
||||||
|
|
||||||
|
|
||||||
else:
|
else:
|
||||||
@ -99,8 +98,7 @@ func _handle_joypad_camera_rotation(delta: float, sens_mod: float = 1.0) -> void
|
|||||||
func walk(delta: float) -> Vector3:
|
func walk(delta: float) -> Vector3:
|
||||||
if Input.mouse_mode == Input.MOUSE_MODE_CAPTURED:
|
if Input.mouse_mode == Input.MOUSE_MODE_CAPTURED:
|
||||||
move_dir = Input.get_vector("move_left", "move_right", "move_forwards", "move_backwards")
|
move_dir = Input.get_vector("move_left", "move_right", "move_forwards", "move_backwards")
|
||||||
var _forward: Vector3 = camera.global_transform.basis * Vector3(move_dir.x, 0, move_dir.y)
|
var walk_dir: Vector3 = Vector3(move_dir.x, 0, move_dir.y).normalized()
|
||||||
var walk_dir: Vector3 = Vector3(_forward.x, 0, _forward.z).normalized()
|
|
||||||
walk_vel = walk_vel.move_toward(walk_dir * speed * move_dir.length(), acceleration * delta)
|
walk_vel = walk_vel.move_toward(walk_dir * speed * move_dir.length(), acceleration * delta)
|
||||||
return walk_vel
|
return walk_vel
|
||||||
|
|
||||||
|
@ -68,6 +68,7 @@ func _on_area_3d_body_entered(body):
|
|||||||
body.player_entered_ship(global_position, self)
|
body.player_entered_ship(global_position, self)
|
||||||
piloting_player = body
|
piloting_player = body
|
||||||
print(self.name)
|
print(self.name)
|
||||||
|
body.reparent(self, true)
|
||||||
|
|
||||||
|
|
||||||
func _on_area_3d_body_exited(body):
|
func _on_area_3d_body_exited(body):
|
||||||
@ -75,6 +76,7 @@ func _on_area_3d_body_exited(body):
|
|||||||
body.player_exited_ship(global_position, self)
|
body.player_exited_ship(global_position, self)
|
||||||
ship_is_piloted = false
|
ship_is_piloted = false
|
||||||
piloting_player = null
|
piloting_player = null
|
||||||
|
body.reparent(get_node("/root/Devlevel"), true)
|
||||||
|
|
||||||
|
|
||||||
func _add_ship_helm(_ship_helm_scene: PackedScene):
|
func _add_ship_helm(_ship_helm_scene: PackedScene):
|
||||||
|
Loading…
Reference in New Issue
Block a user