Add initial head rotation (fix for issue #5)
This commit is contained in:
@ -11,6 +11,8 @@ extends CharacterBody3D
|
|||||||
@export var jump_velocity : float = 4.5
|
@export var jump_velocity : float = 4.5
|
||||||
@export var mouse_sensitivity : float = 0.1
|
@export var mouse_sensitivity : float = 0.1
|
||||||
|
|
||||||
|
@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
|
||||||
@ -60,6 +62,10 @@ 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
|
||||||
|
if initial_facing_direction:
|
||||||
|
HEAD.set_rotation_degrees(initial_facing_direction) # I don't want to be calling this function if the vector is zero
|
||||||
|
|
||||||
# Reset the camera position
|
# Reset the camera position
|
||||||
CAMERA_ANIMATION.play("RESET")
|
CAMERA_ANIMATION.play("RESET")
|
||||||
|
|
||||||
|
@ -123,7 +123,6 @@ shape = SubResource("CapsuleShape3D_uy03j")
|
|||||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1.5, 0)
|
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1.5, 0)
|
||||||
|
|
||||||
[node name="Camera" type="Camera3D" parent="Head"]
|
[node name="Camera" type="Camera3D" parent="Head"]
|
||||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0)
|
|
||||||
|
|
||||||
[node name="camera_animation" type="AnimationPlayer" parent="Head"]
|
[node name="camera_animation" type="AnimationPlayer" parent="Head"]
|
||||||
libraries = {
|
libraries = {
|
||||||
|
Reference in New Issue
Block a user