diff --git a/addons/fpc/EditorModule.gd b/addons/fpc/EditorModule.gd index 28297ce..fa1320b 100644 --- a/addons/fpc/EditorModule.gd +++ b/addons/fpc/EditorModule.gd @@ -1,39 +1,40 @@ @tool extends Node -# This module affects runtime nad +# This does not effect runtime yet but will in the future. - -#TODO: Add descriptions @export_category("Controller Editor Module") -@export var head_y_rotation : float = 0: +@export_range(-360.0, 360.0, 0.01, "or_greater", "or_less") var head_y_rotation : float = 0.0: set(new_rotation): - head_y_rotation = new_rotation - HEAD.rotation.y = head_y_rotation - update_configuration_warnings() + if HEAD: + head_y_rotation = new_rotation + HEAD.rotation.y = deg_to_rad(head_y_rotation) + update_configuration_warnings() +@export_range(-90.0, 90.0, 0.01, "or_greater", "or_less") var head_x_rotation : float = 0.0: + set(new_rotation): + if HEAD: + head_x_rotation = new_rotation + HEAD.rotation.x = deg_to_rad(head_x_rotation) + update_configuration_warnings() @export_group("Nodes") @export var CHARACTER : CharacterBody3D -@export var head_path : String = "Head" # From this nodes parent node +@export var head_path : String = "Head" # Relative to the parent node #@export var CAMERA : Camera3D #@export var HEADBOB_ANIMATION : AnimationPlayer #@export var JUMP_ANIMATION : AnimationPlayer #@export var CROUCH_ANIMATION : AnimationPlayer #@export var COLLISION_MESH : CollisionShape3D -var HEAD +@onready var HEAD = get_node("../" + head_path) func _ready(): - HEAD = get_node("../" + head_path) - if Engine.is_editor_hint(): - pass - else: - HEAD.rotation.y = head_y_rotation + if !Engine.is_editor_hint(): + print("not editor") + HEAD.rotation.y = deg_to_rad(head_y_rotation) + HEAD.rotation.x = deg_to_rad(head_x_rotation) -func _process(delta): - if Engine.is_editor_hint(): - pass func _get_configuration_warnings(): var warnings = [] @@ -41,8 +42,8 @@ func _get_configuration_warnings(): if head_y_rotation > 360: warnings.append("The head rotation is greater than 360") - if head_y_rotation < 0: - warnings.append("The head rotation is less than 0") + if head_y_rotation < -360: + warnings.append("The head rotation is less than -360") # Returning an empty array gives no warnings return warnings diff --git a/addons/fpc/character.tscn b/addons/fpc/character.tscn index e1ab2f0..6be9a13 100644 --- a/addons/fpc/character.tscn +++ b/addons/fpc/character.tscn @@ -383,7 +383,7 @@ transform = Transform3D(-0.730162, 0, -0.683274, 0, 1, 0, 0.683274, 0, -0.730162 libraries = { "": SubResource("AnimationLibrary_o0unb") } -blend_times = [&"walk", &"RESET", 0.5, &"RESET", &"walk", 0.5, &"RESET", &"RESET", 0.5] +blend_times = [&"RESET", &"RESET", 0.5, &"RESET", &"walk", 0.5, &"walk", &"RESET", 0.5] [node name="JumpAnimation" type="AnimationPlayer" parent="Head"] libraries = { @@ -423,4 +423,3 @@ target_position = Vector3(0, 0.5, 0) [node name="EditorModule" type="Node" parent="."] script = ExtResource("3_v3ckk") -head_y_rotation = -136.9