Replace initial_facing_direction with a smarter approach (why didn't I think of this the first time)

This commit is contained in:
2024-03-25 20:41:57 -07:00
parent bb36e697e4
commit 11b41ea13d

View File

@ -13,8 +13,6 @@ extends CharacterBody3D
@export var immobile : bool = false @export var immobile : bool = false
@export_file var default_reticle @export_file var default_reticle
@export var initial_facing_direction : Vector3 = Vector3.ZERO
@export_group("Nodes") @export_group("Nodes")
@export var HEAD : Node3D @export var HEAD : Node3D
@export var CAMERA : Camera3D @export var CAMERA : Camera3D
@ -71,9 +69,8 @@ var gravity : float = ProjectSettings.get_setting("physics/3d/default_gravity")
func _ready(): func _ready():
Input.mouse_mode = Input.MOUSE_MODE_CAPTURED Input.mouse_mode = Input.MOUSE_MODE_CAPTURED
# Set the camera rotation to whatever initial_facing_direction is HEAD.rotation = rotation
if initial_facing_direction: rotation = Vector3.ZERO
HEAD.set_rotation_degrees(initial_facing_direction) # I don't want to be calling this function if the vector is zero
if default_reticle: if default_reticle:
change_reticle(default_reticle) change_reticle(default_reticle)