Some changes

This commit is contained in:
2025-01-25 14:16:37 +01:00
parent 1f1f2918c9
commit 5866eb267e
3 changed files with 15 additions and 3 deletions

View File

@ -14,7 +14,7 @@ var mouse_captured: bool = false
@onready var first_view_camera_mount: Node3D = $FirstPersonCameraMount
@onready var first_view_camera: Camera3D = $FirstPersonCameraMount/Camera
@onready var model_mount: Node3D = $ModelMount
@onready var main_collision: CollisionShape3D = $MainCollision
# -- This node is supposed to be spawned per player, and since each
# -- player has an id, it is used for giving a node a name. So we can
# -- use it here to tell a controlled node from the rest models
@ -52,9 +52,16 @@ func _add_world_model() -> Error :
if not ResourceLoader.exists(path):
return ERR_DOES_NOT_EXIST
var scene: PackedScene = ResourceLoader.load(path)
var lowest_local_point = Vector3.ZERO
var shape = main_collision.shape
var radius = shape.radius
var height = shape.height
lowest_local_point = Vector3(0, 0.1, 0)
if not scene.can_instantiate():
return ERR_CANT_OPEN
var node: Node3D = scene.instantiate()
node.position = lowest_local_point
model_mount.add_child(node)
return OK
@ -114,7 +121,6 @@ func _unhandled_input(event: InputEvent) -> void:
#if Input.is_action_just_pressed("reload"): $Body/UpperTorso/CameraMount/Camera.reload()
func _rotate_camera(sens_mod: float = 1.0) -> void:
#if str($"..".name).to_int() == multiplayer.get_unique_id():
rotation.y -= look_dir.x * camera_sens * sens_mod
first_view_camera_mount.rotation.x = clamp(first_view_camera_mount.rotation.x - look_dir.y * camera_sens * sens_mod, -1.5, 1.5)