Compare commits
30 Commits
Author | SHA1 | Date | |
---|---|---|---|
a8d151d568 | |||
b458cba1a1 | |||
|
4782f80ec2 | ||
|
8a398bade0 | ||
28becd88c2 | |||
|
1f9bbd73b3 | ||
|
4c0152e688 | ||
|
2d654f7600 | ||
6257f07766 | |||
|
6a6de243dd | ||
|
669c951a81 | ||
c64deaa27a | |||
be0001e554 | |||
2879337ad2 | |||
80476b2757 | |||
53935057cd | |||
02018a0105 | |||
c44be3fbfb | |||
b928d6c76b | |||
468ff36f4d | |||
12cf4d63ab | |||
11958e5020 | |||
11b41ea13d | |||
bb36e697e4 | |||
3349efe6bb | |||
0d476da456 | |||
7de0801802 | |||
712836f13c | |||
eee84d84cc | |||
3b78a2fcf8 |
31
README.md
31
README.md
@ -11,14 +11,16 @@ Some parts came from StayAtHomeDev's FPS tutorial. You can find that [here](http
|
|||||||
Move with WASD, space to jump, shift to sprint, C to crouch.
|
Move with WASD, space to jump, shift to sprint, C to crouch.
|
||||||
|
|
||||||
**FEATURES:**
|
**FEATURES:**
|
||||||
- In-air momentum
|
- Extremely configurable
|
||||||
- Motion smoothing
|
- In-air momentum
|
||||||
- FOV smoothing
|
- Motion smoothing
|
||||||
- Head bobbing
|
- FOV smoothing
|
||||||
- Crouching
|
- Movement animations
|
||||||
- Sprinting
|
- Crouching
|
||||||
- 2 crosshairs/reticles, one is animated (more to come?)
|
- Sprinting
|
||||||
- Controller/GamePad support (enabled through code, see wiki)
|
- 2 crosshairs/reticles, one is animated (more to come?)
|
||||||
|
- Controller/GamePad support (enabled through code, see wiki)
|
||||||
|
- In-editor tools (enable editable children to use)
|
||||||
|
|
||||||
If you make a cool game with this addon, I would love to hear about it!
|
If you make a cool game with this addon, I would love to hear about it!
|
||||||
|
|
||||||
@ -31,7 +33,7 @@ You can make this a super basic controller by just disabling everything.
|
|||||||
- In the controls export group, there is a commented section at the end that says "Uncomment this if you want full controller support". Uncomment that block.
|
- In the controls export group, there is a commented section at the end that says "Uncomment this if you want full controller support". Uncomment that block.
|
||||||
- Make a key map for each direction (left, right, up, down) and map them to your joystick.
|
- Make a key map for each direction (left, right, up, down) and map them to your joystick.
|
||||||
- Write in these keymaps in the controls section of the player settings.
|
- Write in these keymaps in the controls section of the player settings.
|
||||||
- In the `_process` function, there is another block of commented code at the end that says the same thing. Uncomment that too.
|
- In the `handle_head_rotation` function, there is another block of commented code that says the same thing. Uncomment that too.
|
||||||
- You should now be able to look around with the joystick. Make sure you add the other controls to the input map. (movement, jumping, crouching, sprinting, etc.)
|
- You should now be able to look around with the joystick. Make sure you add the other controls to the input map. (movement, jumping, crouching, sprinting, etc.)
|
||||||
|
|
||||||
**How to change settings:**
|
**How to change settings:**
|
||||||
@ -44,10 +46,9 @@ Click on the character node and there should be settings in the "Feature Setting
|
|||||||
- Use the `is_on_floor` function to tell if the player is standing or falling.
|
- Use the `is_on_floor` function to tell if the player is standing or falling.
|
||||||
|
|
||||||
**How to change reticles (crosshairs):**
|
**How to change reticles (crosshairs):**
|
||||||
- Find the folder at `res://addons/fpc/reticles`.
|
Change the "Default Reticle" setting to your reticle file.
|
||||||
- Pick one and add it to the `UserInterface` node in the character scene. You may need to right click on the character and enable "Editable Children".
|
During runtime:
|
||||||
- Set the Character value to your character node. (it's under the Nodes group)
|
Use the `change_reticle` function on the character.
|
||||||
- Change the `anchors_preset` value on the reticle to Center.
|
|
||||||
|
|
||||||
**How to create a new reticle:**
|
**How to create a new reticle:**
|
||||||
- Choose a reticle to base it off of.
|
- Choose a reticle to base it off of.
|
||||||
@ -56,3 +57,7 @@ Click on the character node and there should be settings in the "Feature Setting
|
|||||||
- Edit the reticle to your needs.
|
- Edit the reticle to your needs.
|
||||||
- Follow the "how to change reticles" directions to use it.
|
- Follow the "how to change reticles" directions to use it.
|
||||||
|
|
||||||
|
**How to use the editor tools:**
|
||||||
|
- Enable editable children on the `CharacterBody` node
|
||||||
|
- Use the options in the Properties tab to change things
|
||||||
|
- These changes apply in runtime as well
|
||||||
|
48
addons/fpc/EditorModule.gd
Normal file
48
addons/fpc/EditorModule.gd
Normal file
@ -0,0 +1,48 @@
|
|||||||
|
@tool
|
||||||
|
extends Node
|
||||||
|
|
||||||
|
# This module affects runtime nad
|
||||||
|
|
||||||
|
|
||||||
|
#TODO: Add descriptions
|
||||||
|
@export_category("Controller Editor Module")
|
||||||
|
@export var head_y_rotation : float = 0:
|
||||||
|
set(new_rotation):
|
||||||
|
head_y_rotation = new_rotation
|
||||||
|
HEAD.rotation.y = head_y_rotation
|
||||||
|
update_configuration_warnings()
|
||||||
|
|
||||||
|
@export_group("Nodes")
|
||||||
|
@export var CHARACTER : CharacterBody3D
|
||||||
|
@export var head_path : String = "Head" # From this nodes 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
|
||||||
|
|
||||||
|
|
||||||
|
func _ready():
|
||||||
|
HEAD = get_node("../" + head_path)
|
||||||
|
if Engine.is_editor_hint():
|
||||||
|
pass
|
||||||
|
else:
|
||||||
|
HEAD.rotation.y = head_y_rotation
|
||||||
|
|
||||||
|
func _process(delta):
|
||||||
|
if Engine.is_editor_hint():
|
||||||
|
pass
|
||||||
|
|
||||||
|
func _get_configuration_warnings():
|
||||||
|
var 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")
|
||||||
|
|
||||||
|
# Returning an empty array gives no warnings
|
||||||
|
return warnings
|
@ -1,7 +1,14 @@
|
|||||||
|
|
||||||
|
# COPYRIGHT Colormatic Studios
|
||||||
|
# MIT licence
|
||||||
|
# Quality Godot First Person Controller v2
|
||||||
|
|
||||||
|
|
||||||
extends CharacterBody3D
|
extends CharacterBody3D
|
||||||
|
|
||||||
# TODO: Add descriptions for each value
|
# TODO: Add descriptions for each value
|
||||||
|
|
||||||
|
|
||||||
@export_category("Character")
|
@export_category("Character")
|
||||||
@export var base_speed : float = 3.0
|
@export var base_speed : float = 3.0
|
||||||
@export var sprint_speed : float = 6.0
|
@export var sprint_speed : float = 6.0
|
||||||
@ -10,8 +17,8 @@ extends CharacterBody3D
|
|||||||
@export var acceleration : float = 10.0
|
@export var acceleration : float = 10.0
|
||||||
@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 immobile : bool = false
|
||||||
@export var initial_facing_direction : Vector3 = Vector3.ZERO
|
@export_file var default_reticle
|
||||||
|
|
||||||
@export_group("Nodes")
|
@export_group("Nodes")
|
||||||
@export var HEAD : Node3D
|
@export var HEAD : Node3D
|
||||||
@ -29,17 +36,16 @@ extends CharacterBody3D
|
|||||||
@export var FORWARD : String = "ui_up"
|
@export var FORWARD : String = "ui_up"
|
||||||
@export var BACKWARD : String = "ui_down"
|
@export var BACKWARD : String = "ui_down"
|
||||||
@export var PAUSE : String = "ui_cancel"
|
@export var PAUSE : String = "ui_cancel"
|
||||||
@export var CROUCH : String
|
@export var CROUCH : String = "crouch"
|
||||||
@export var SPRINT : String
|
@export var SPRINT : String = "sprint"
|
||||||
|
|
||||||
# Uncomment if you want full controller support
|
# Uncomment if you want full controller support
|
||||||
#@export var LOOK_LEFT : String
|
#@export var LOOK_LEFT : String = "look_left"
|
||||||
#@export var LOOK_RIGHT : String
|
#@export var LOOK_RIGHT : String = "look_right"
|
||||||
#@export var LOOK_UP : String
|
#@export var LOOK_UP : String = "look_up"
|
||||||
#@export var LOOK_DOWN : String
|
#@export var LOOK_DOWN : String = "look_down"
|
||||||
|
|
||||||
@export_group("Feature Settings")
|
@export_group("Feature Settings")
|
||||||
@export var immobile : bool = false
|
|
||||||
@export var jumping_enabled : bool = true
|
@export var jumping_enabled : bool = true
|
||||||
@export var in_air_momentum : bool = true
|
@export var in_air_momentum : bool = true
|
||||||
@export var motion_smoothing : bool = true
|
@export var motion_smoothing : bool = true
|
||||||
@ -51,6 +57,9 @@ extends CharacterBody3D
|
|||||||
@export var continuous_jumping : bool = true
|
@export var continuous_jumping : bool = true
|
||||||
@export var view_bobbing : bool = true
|
@export var view_bobbing : bool = true
|
||||||
@export var jump_animation : bool = true
|
@export var jump_animation : bool = true
|
||||||
|
@export var pausing_enabled : bool = true
|
||||||
|
@export var gravity_enabled : bool = true
|
||||||
|
|
||||||
|
|
||||||
# Member variables
|
# Member variables
|
||||||
var speed : float = base_speed
|
var speed : float = base_speed
|
||||||
@ -58,25 +67,75 @@ var current_speed : float = 0.0
|
|||||||
# States: normal, crouching, sprinting
|
# States: normal, crouching, sprinting
|
||||||
var state : String = "normal"
|
var state : String = "normal"
|
||||||
var low_ceiling : bool = false # This is for when the cieling is too low and the player needs to crouch.
|
var low_ceiling : bool = false # This is for when the cieling is too low and the player needs to crouch.
|
||||||
var was_on_floor : bool = true
|
var was_on_floor : bool = true # Was the player on the floor last frame (for landing animation)
|
||||||
|
|
||||||
|
# The reticle should always have a Control node as the root
|
||||||
|
var RETICLE : Control
|
||||||
|
|
||||||
# Get the gravity from the project settings to be synced with RigidBody nodes
|
# Get the gravity from the project settings to be synced with RigidBody nodes
|
||||||
var gravity : float = ProjectSettings.get_setting("physics/3d/default_gravity") # Don't set this as a const, see the gravity section in _physics_process
|
var gravity : float = ProjectSettings.get_setting("physics/3d/default_gravity") # Don't set this as a const, see the gravity section in _physics_process
|
||||||
|
|
||||||
|
# Stores mouse input for rotating the camera in the phyhsics process
|
||||||
|
var mouseInput : Vector2 = Vector2(0,0)
|
||||||
|
|
||||||
func _ready():
|
func _ready():
|
||||||
|
#It is safe to comment this line if your game doesn't start with the mouse captured
|
||||||
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 the controller is rotated in a certain direction for game design purposes, redirect this rotation into the head.
|
||||||
if initial_facing_direction:
|
HEAD.rotation.y = rotation.y
|
||||||
HEAD.set_rotation_degrees(initial_facing_direction) # I don't want to be calling this function if the vector is zero
|
rotation.y = 0
|
||||||
|
|
||||||
|
if default_reticle:
|
||||||
|
change_reticle(default_reticle)
|
||||||
|
|
||||||
# Reset the camera position
|
# Reset the camera position
|
||||||
|
# If you want to change the default head height, change these animations.
|
||||||
HEADBOB_ANIMATION.play("RESET")
|
HEADBOB_ANIMATION.play("RESET")
|
||||||
JUMP_ANIMATION.play("RESET")
|
JUMP_ANIMATION.play("RESET")
|
||||||
|
CROUCH_ANIMATION.play("RESET")
|
||||||
|
|
||||||
|
check_controls()
|
||||||
|
|
||||||
|
func check_controls(): # If you add a control, you might want to add a check for it here.
|
||||||
|
# The actions are being disabled so the engine doesn't halt the entire project in debug mode
|
||||||
|
if !InputMap.has_action(JUMP):
|
||||||
|
push_error("No control mapped for jumping. Please add an input map control. Disabling jump.")
|
||||||
|
jumping_enabled = false
|
||||||
|
if !InputMap.has_action(LEFT):
|
||||||
|
push_error("No control mapped for move left. Please add an input map control. Disabling movement.")
|
||||||
|
immobile = true
|
||||||
|
if !InputMap.has_action(RIGHT):
|
||||||
|
push_error("No control mapped for move right. Please add an input map control. Disabling movement.")
|
||||||
|
immobile = true
|
||||||
|
if !InputMap.has_action(FORWARD):
|
||||||
|
push_error("No control mapped for move forward. Please add an input map control. Disabling movement.")
|
||||||
|
immobile = true
|
||||||
|
if !InputMap.has_action(BACKWARD):
|
||||||
|
push_error("No control mapped for move backward. Please add an input map control. Disabling movement.")
|
||||||
|
immobile = true
|
||||||
|
if !InputMap.has_action(PAUSE):
|
||||||
|
push_error("No control mapped for pause. Please add an input map control. Disabling pausing.")
|
||||||
|
pausing_enabled = false
|
||||||
|
if !InputMap.has_action(CROUCH):
|
||||||
|
push_error("No control mapped for crouch. Please add an input map control. Disabling crouching.")
|
||||||
|
crouch_enabled = false
|
||||||
|
if !InputMap.has_action(SPRINT):
|
||||||
|
push_error("No control mapped for sprint. Please add an input map control. Disabling sprinting.")
|
||||||
|
sprint_enabled = false
|
||||||
|
|
||||||
|
|
||||||
|
func change_reticle(reticle): # Yup, this function is kinda strange
|
||||||
|
if RETICLE:
|
||||||
|
RETICLE.queue_free()
|
||||||
|
|
||||||
|
RETICLE = load(reticle).instantiate()
|
||||||
|
RETICLE.character = self
|
||||||
|
$UserInterface.add_child(RETICLE)
|
||||||
|
|
||||||
|
|
||||||
func _physics_process(delta):
|
func _physics_process(delta):
|
||||||
|
# Big thanks to github.com/LorenzoAncora for the concept of the improved debug values
|
||||||
current_speed = Vector3.ZERO.distance_to(get_real_velocity())
|
current_speed = Vector3.ZERO.distance_to(get_real_velocity())
|
||||||
$UserInterface/DebugPanel.add_property("Speed", snappedf(current_speed, 0.001), 1)
|
$UserInterface/DebugPanel.add_property("Speed", snappedf(current_speed, 0.001), 1)
|
||||||
$UserInterface/DebugPanel.add_property("Target speed", speed, 2)
|
$UserInterface/DebugPanel.add_property("Target speed", speed, 2)
|
||||||
@ -91,43 +150,50 @@ func _physics_process(delta):
|
|||||||
|
|
||||||
# Gravity
|
# Gravity
|
||||||
#gravity = ProjectSettings.get_setting("physics/3d/default_gravity") # If the gravity changes during your game, uncomment this code
|
#gravity = ProjectSettings.get_setting("physics/3d/default_gravity") # If the gravity changes during your game, uncomment this code
|
||||||
if not is_on_floor():
|
if not is_on_floor() and gravity and gravity_enabled:
|
||||||
velocity.y -= gravity * delta
|
velocity.y -= gravity * delta
|
||||||
|
|
||||||
handle_jumping()
|
handle_jumping()
|
||||||
|
|
||||||
var input_dir = Vector2.ZERO
|
var input_dir = Vector2.ZERO
|
||||||
if !immobile:
|
if !immobile: # Immobility works by interrupting user input, so other forces can still be applied to the player
|
||||||
input_dir = Input.get_vector(LEFT, RIGHT, FORWARD, BACKWARD)
|
input_dir = Input.get_vector(LEFT, RIGHT, FORWARD, BACKWARD)
|
||||||
handle_movement(delta, input_dir)
|
handle_movement(delta, input_dir)
|
||||||
|
|
||||||
|
handle_head_rotation()
|
||||||
|
|
||||||
|
# The player is not able to stand up if the ceiling is too low
|
||||||
low_ceiling = $CrouchCeilingDetection.is_colliding()
|
low_ceiling = $CrouchCeilingDetection.is_colliding()
|
||||||
|
|
||||||
handle_state(input_dir)
|
handle_state(input_dir)
|
||||||
if dynamic_fov:
|
if dynamic_fov: # This may be changed to an AnimationPlayer
|
||||||
update_camera_fov()
|
update_camera_fov()
|
||||||
|
|
||||||
if view_bobbing:
|
if view_bobbing:
|
||||||
headbob_animation(input_dir)
|
headbob_animation(input_dir)
|
||||||
|
|
||||||
if jump_animation:
|
if jump_animation:
|
||||||
if !was_on_floor and is_on_floor(): # Just landed
|
if !was_on_floor and is_on_floor(): # The player just landed
|
||||||
JUMP_ANIMATION.play("land")
|
match randi() % 2: #TODO: Change this to detecting velocity direction
|
||||||
|
0:
|
||||||
was_on_floor = is_on_floor() # This must always be at the end of physics_process
|
JUMP_ANIMATION.play("land_left", 0.25)
|
||||||
|
1:
|
||||||
|
JUMP_ANIMATION.play("land_right", 0.25)
|
||||||
|
|
||||||
|
was_on_floor = is_on_floor() # This must always be at the end of physics_process
|
||||||
|
|
||||||
|
|
||||||
func handle_jumping():
|
func handle_jumping():
|
||||||
if jumping_enabled:
|
if jumping_enabled:
|
||||||
if continuous_jumping:
|
if continuous_jumping: # Hold down the jump button
|
||||||
if Input.is_action_pressed(JUMP) and is_on_floor() and !low_ceiling:
|
if Input.is_action_pressed(JUMP) and is_on_floor() and !low_ceiling:
|
||||||
if jump_animation:
|
if jump_animation:
|
||||||
JUMP_ANIMATION.play("jump")
|
JUMP_ANIMATION.play("jump", 0.25)
|
||||||
velocity.y += jump_velocity
|
velocity.y += jump_velocity # Adding instead of setting so jumping on slopes works properly
|
||||||
else:
|
else:
|
||||||
if Input.is_action_just_pressed(JUMP) and is_on_floor() and !low_ceiling:
|
if Input.is_action_just_pressed(JUMP) and is_on_floor() and !low_ceiling:
|
||||||
if jump_animation:
|
if jump_animation:
|
||||||
JUMP_ANIMATION.play("jump")
|
JUMP_ANIMATION.play("jump", 0.25)
|
||||||
velocity.y += jump_velocity
|
velocity.y += jump_velocity
|
||||||
|
|
||||||
|
|
||||||
@ -152,6 +218,18 @@ func handle_movement(delta, input_dir):
|
|||||||
velocity.x = direction.x * speed
|
velocity.x = direction.x * speed
|
||||||
velocity.z = direction.z * speed
|
velocity.z = direction.z * speed
|
||||||
|
|
||||||
|
func handle_head_rotation():
|
||||||
|
HEAD.rotation_degrees.y -= mouseInput.x * mouse_sensitivity
|
||||||
|
HEAD.rotation_degrees.x -= mouseInput.y * mouse_sensitivity
|
||||||
|
|
||||||
|
# Uncomment for controller support
|
||||||
|
#var controller_view_rotation = Input.get_vector(LOOK_DOWN, LOOK_UP, LOOK_RIGHT, LOOK_LEFT) * 0.035 # These are inverted because of the nature of 3D rotation.
|
||||||
|
#HEAD.rotation.x += controller_view_rotation.x
|
||||||
|
#HEAD.rotation.y += controller_view_rotation.y
|
||||||
|
|
||||||
|
mouseInput = Vector2(0,0)
|
||||||
|
HEAD.rotation.x = clamp(HEAD.rotation.x, deg_to_rad(-90), deg_to_rad(90))
|
||||||
|
|
||||||
|
|
||||||
func handle_state(moving):
|
func handle_state(moving):
|
||||||
if sprint_enabled:
|
if sprint_enabled:
|
||||||
@ -231,20 +309,30 @@ func update_camera_fov():
|
|||||||
|
|
||||||
func headbob_animation(moving):
|
func headbob_animation(moving):
|
||||||
if moving and is_on_floor():
|
if moving and is_on_floor():
|
||||||
|
var use_headbob_animation : String
|
||||||
|
match state:
|
||||||
|
"normal","crouching":
|
||||||
|
use_headbob_animation = "walk"
|
||||||
|
"sprinting":
|
||||||
|
use_headbob_animation = "sprint"
|
||||||
|
|
||||||
var was_playing : bool = false
|
var was_playing : bool = false
|
||||||
if HEADBOB_ANIMATION.current_animation == "headbob":
|
if HEADBOB_ANIMATION.current_animation == use_headbob_animation:
|
||||||
was_playing = true
|
was_playing = true
|
||||||
HEADBOB_ANIMATION.play("headbob", 0.25)
|
|
||||||
|
HEADBOB_ANIMATION.play(use_headbob_animation, 0.25)
|
||||||
HEADBOB_ANIMATION.speed_scale = (current_speed / base_speed) * 1.75
|
HEADBOB_ANIMATION.speed_scale = (current_speed / base_speed) * 1.75
|
||||||
if !was_playing:
|
if !was_playing:
|
||||||
HEADBOB_ANIMATION.seek(float(randi() % 2)) # Randomize the initial headbob direction
|
HEADBOB_ANIMATION.seek(float(randi() % 2)) # Randomize the initial headbob direction
|
||||||
# Let me explain that piece of code because it looks like it does the opposite of what it actually does.
|
# Let me explain that piece of code because it looks like it does the opposite of what it actually does.
|
||||||
# The headbob animation has two starting positions. One is at 0 and the other is at 1.
|
# The headbob animation has two starting positions. One is at 0 and the other is at 1.
|
||||||
# randi() % 2 returns either 0 or 1, and so the animation randomly starts at one of the starting positions.
|
# randi() % 2 returns either 0 or 1, and so the animation randomly starts at one of the starting positions.
|
||||||
|
# This code is extremely performant but it makes no sense.
|
||||||
|
|
||||||
else:
|
else:
|
||||||
HEADBOB_ANIMATION.play("RESET", 0.25)
|
if HEADBOB_ANIMATION.current_animation == "sprint" or HEADBOB_ANIMATION.current_animation == "walk":
|
||||||
HEADBOB_ANIMATION.speed_scale = 1
|
HEADBOB_ANIMATION.speed_scale = 1
|
||||||
|
HEADBOB_ANIMATION.play("RESET", 1)
|
||||||
|
|
||||||
|
|
||||||
func _process(delta):
|
func _process(delta):
|
||||||
@ -254,21 +342,16 @@ func _process(delta):
|
|||||||
status += " in the air"
|
status += " in the air"
|
||||||
$UserInterface/DebugPanel.add_property("State", status, 4)
|
$UserInterface/DebugPanel.add_property("State", status, 4)
|
||||||
|
|
||||||
if Input.is_action_just_pressed(PAUSE):
|
if pausing_enabled:
|
||||||
if Input.mouse_mode == Input.MOUSE_MODE_CAPTURED:
|
if Input.is_action_just_pressed(PAUSE):
|
||||||
Input.mouse_mode = Input.MOUSE_MODE_VISIBLE
|
match Input.mouse_mode:
|
||||||
elif Input.mouse_mode == Input.MOUSE_MODE_VISIBLE:
|
Input.MOUSE_MODE_CAPTURED:
|
||||||
Input.mouse_mode = Input.MOUSE_MODE_CAPTURED
|
Input.mouse_mode = Input.MOUSE_MODE_VISIBLE
|
||||||
|
Input.MOUSE_MODE_VISIBLE:
|
||||||
HEAD.rotation.x = clamp(HEAD.rotation.x, deg_to_rad(-90), deg_to_rad(90))
|
Input.mouse_mode = Input.MOUSE_MODE_CAPTURED
|
||||||
|
|
||||||
# Uncomment if you want full controller support
|
|
||||||
#var controller_view_rotation = Input.get_vector(LOOK_LEFT, LOOK_RIGHT, LOOK_UP, LOOK_DOWN)
|
|
||||||
#HEAD.rotation_degrees.y -= controller_view_rotation.x * 1.5
|
|
||||||
#HEAD.rotation_degrees.x -= controller_view_rotation.y * 1.5
|
|
||||||
|
|
||||||
|
|
||||||
func _unhandled_input(event):
|
func _unhandled_input(event):
|
||||||
if event is InputEventMouseMotion and Input.mouse_mode == Input.MOUSE_MODE_CAPTURED:
|
if event is InputEventMouseMotion and Input.mouse_mode == Input.MOUSE_MODE_CAPTURED:
|
||||||
HEAD.rotation_degrees.y -= event.relative.x * mouse_sensitivity
|
mouseInput.x += event.relative.x
|
||||||
HEAD.rotation_degrees.x -= event.relative.y * mouse_sensitivity
|
mouseInput.y += event.relative.y
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
[gd_scene load_steps=19 format=3 uid="uid://cc1m2a1obsyn4"]
|
[gd_scene load_steps=21 format=3 uid="uid://cc1m2a1obsyn4"]
|
||||||
|
|
||||||
[ext_resource type="Script" path="res://addons/fpc/character.gd" id="1_0t4e8"]
|
[ext_resource type="Script" path="res://addons/fpc/character.gd" id="1_0t4e8"]
|
||||||
[ext_resource type="PackedScene" uid="uid://3mij3cjhkwsm" path="res://addons/fpc/reticles/reticle_1.tscn" id="2_uuexm"]
|
[ext_resource type="Script" path="res://addons/fpc/EditorModule.gd" id="3_v3ckk"]
|
||||||
[ext_resource type="Script" path="res://addons/fpc/debug.gd" id="3_x1wcc"]
|
[ext_resource type="Script" path="res://addons/fpc/debug.gd" id="3_x1wcc"]
|
||||||
|
|
||||||
[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_kp17n"]
|
[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_kp17n"]
|
||||||
@ -14,30 +14,67 @@ material = SubResource("StandardMaterial3D_kp17n")
|
|||||||
|
|
||||||
[sub_resource type="CapsuleShape3D" id="CapsuleShape3D_uy03j"]
|
[sub_resource type="CapsuleShape3D" id="CapsuleShape3D_uy03j"]
|
||||||
|
|
||||||
[sub_resource type="Animation" id="Animation_pqev3"]
|
[sub_resource type="Animation" id="Animation_j8cx7"]
|
||||||
|
resource_name = "RESET"
|
||||||
length = 0.001
|
length = 0.001
|
||||||
tracks/0/type = "value"
|
tracks/0/type = "value"
|
||||||
tracks/0/imported = false
|
tracks/0/imported = false
|
||||||
tracks/0/enabled = true
|
tracks/0/enabled = true
|
||||||
tracks/0/path = NodePath("Mesh:position")
|
tracks/0/path = NodePath("Mesh:scale")
|
||||||
tracks/0/interp = 1
|
tracks/0/interp = 2
|
||||||
tracks/0/loop_wrap = true
|
tracks/0/loop_wrap = true
|
||||||
tracks/0/keys = {
|
tracks/0/keys = {
|
||||||
"times": PackedFloat32Array(0),
|
"times": PackedFloat32Array(0),
|
||||||
"transitions": PackedFloat32Array(1),
|
"transitions": PackedFloat32Array(1),
|
||||||
"update": 0,
|
"update": 0,
|
||||||
"values": [Vector3(0, 1, 0)]
|
"values": [Vector3(1, 1, 1)]
|
||||||
}
|
}
|
||||||
tracks/1/type = "value"
|
tracks/1/type = "value"
|
||||||
tracks/1/imported = false
|
tracks/1/imported = false
|
||||||
tracks/1/enabled = true
|
tracks/1/enabled = true
|
||||||
tracks/1/path = NodePath("Head:position")
|
tracks/1/path = NodePath("Collision:scale")
|
||||||
tracks/1/interp = 1
|
tracks/1/interp = 2
|
||||||
tracks/1/loop_wrap = true
|
tracks/1/loop_wrap = true
|
||||||
tracks/1/keys = {
|
tracks/1/keys = {
|
||||||
"times": PackedFloat32Array(0),
|
"times": PackedFloat32Array(0),
|
||||||
"transitions": PackedFloat32Array(1),
|
"transitions": PackedFloat32Array(1),
|
||||||
"update": 0,
|
"update": 0,
|
||||||
|
"values": [Vector3(1, 1, 1)]
|
||||||
|
}
|
||||||
|
tracks/2/type = "value"
|
||||||
|
tracks/2/imported = false
|
||||||
|
tracks/2/enabled = true
|
||||||
|
tracks/2/path = NodePath("Mesh:position")
|
||||||
|
tracks/2/interp = 2
|
||||||
|
tracks/2/loop_wrap = true
|
||||||
|
tracks/2/keys = {
|
||||||
|
"times": PackedFloat32Array(0),
|
||||||
|
"transitions": PackedFloat32Array(1),
|
||||||
|
"update": 0,
|
||||||
|
"values": [Vector3(0, 1, 0)]
|
||||||
|
}
|
||||||
|
tracks/3/type = "value"
|
||||||
|
tracks/3/imported = false
|
||||||
|
tracks/3/enabled = true
|
||||||
|
tracks/3/path = NodePath("Collision:position")
|
||||||
|
tracks/3/interp = 2
|
||||||
|
tracks/3/loop_wrap = true
|
||||||
|
tracks/3/keys = {
|
||||||
|
"times": PackedFloat32Array(0),
|
||||||
|
"transitions": PackedFloat32Array(1),
|
||||||
|
"update": 0,
|
||||||
|
"values": [Vector3(0, 1, 0)]
|
||||||
|
}
|
||||||
|
tracks/4/type = "value"
|
||||||
|
tracks/4/imported = false
|
||||||
|
tracks/4/enabled = true
|
||||||
|
tracks/4/path = NodePath("Head:position")
|
||||||
|
tracks/4/interp = 2
|
||||||
|
tracks/4/loop_wrap = true
|
||||||
|
tracks/4/keys = {
|
||||||
|
"times": PackedFloat32Array(0),
|
||||||
|
"transitions": PackedFloat32Array(1),
|
||||||
|
"update": 0,
|
||||||
"values": [Vector3(0, 1.5, 0)]
|
"values": [Vector3(0, 1.5, 0)]
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -107,7 +144,7 @@ tracks/4/keys = {
|
|||||||
|
|
||||||
[sub_resource type="AnimationLibrary" id="AnimationLibrary_5e5t5"]
|
[sub_resource type="AnimationLibrary" id="AnimationLibrary_5e5t5"]
|
||||||
_data = {
|
_data = {
|
||||||
"RESET": SubResource("Animation_pqev3"),
|
"RESET": SubResource("Animation_j8cx7"),
|
||||||
"crouch": SubResource("Animation_5ec5e")
|
"crouch": SubResource("Animation_5ec5e")
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -137,20 +174,9 @@ tracks/1/keys = {
|
|||||||
"points": PackedFloat32Array(0, -0.25, 0, 0.25, 0),
|
"points": PackedFloat32Array(0, -0.25, 0, 0.25, 0),
|
||||||
"times": PackedFloat32Array(0)
|
"times": PackedFloat32Array(0)
|
||||||
}
|
}
|
||||||
tracks/2/type = "bezier"
|
|
||||||
tracks/2/imported = false
|
|
||||||
tracks/2/enabled = true
|
|
||||||
tracks/2/path = NodePath("Camera:position:z")
|
|
||||||
tracks/2/interp = 1
|
|
||||||
tracks/2/loop_wrap = true
|
|
||||||
tracks/2/keys = {
|
|
||||||
"handle_modes": PackedInt32Array(0),
|
|
||||||
"points": PackedFloat32Array(0, -0.25, 0, 0.25, 0),
|
|
||||||
"times": PackedFloat32Array(0)
|
|
||||||
}
|
|
||||||
|
|
||||||
[sub_resource type="Animation" id="Animation_lrqmv"]
|
[sub_resource type="Animation" id="Animation_8ku67"]
|
||||||
resource_name = "headbob"
|
resource_name = "sprint"
|
||||||
length = 2.0
|
length = 2.0
|
||||||
loop_mode = 1
|
loop_mode = 1
|
||||||
tracks/0/type = "bezier"
|
tracks/0/type = "bezier"
|
||||||
@ -160,8 +186,35 @@ tracks/0/path = NodePath("Camera:position:x")
|
|||||||
tracks/0/interp = 1
|
tracks/0/interp = 1
|
||||||
tracks/0/loop_wrap = true
|
tracks/0/loop_wrap = true
|
||||||
tracks/0/keys = {
|
tracks/0/keys = {
|
||||||
|
"handle_modes": PackedInt32Array(0, 1, 0, 1, 0),
|
||||||
|
"points": PackedFloat32Array(0.06, -0.25, 0, 0.25, -0.01, 0, 0, 0, 0, 0, -0.06, -0.25, 0.01, 0.25, 0.01, 0, 0, 0, 0, 0, 0.06, -0.25, -0.01, 0.25, 0),
|
||||||
|
"times": PackedFloat32Array(0, 0.5, 1, 1.5, 2)
|
||||||
|
}
|
||||||
|
tracks/1/type = "bezier"
|
||||||
|
tracks/1/imported = false
|
||||||
|
tracks/1/enabled = true
|
||||||
|
tracks/1/path = NodePath("Camera:position:y")
|
||||||
|
tracks/1/interp = 1
|
||||||
|
tracks/1/loop_wrap = true
|
||||||
|
tracks/1/keys = {
|
||||||
"handle_modes": PackedInt32Array(0, 0, 0, 0, 0),
|
"handle_modes": PackedInt32Array(0, 0, 0, 0, 0),
|
||||||
"points": PackedFloat32Array(0.04, -0.25, 0, 0.25, 0, 0, -0.25, 0, 0.25, 0, -0.04, -0.25, 0, 0.25, 0, 0, -0.25, 0, 0.25, 0, 0.04, -0.25, 0, 0.25, 0),
|
"points": PackedFloat32Array(0.05, -0.25, 0, 0.2, -0.01, 0, -0.2, 0.000186046, 0.2, 0.000186046, 0.05, -0.2, -0.01, 0.2, -0.01, 0, -0.2, 0, 0.2, 0, 0.05, -0.2, -0.01, 0.25, 0),
|
||||||
|
"times": PackedFloat32Array(0, 0.5, 1, 1.5, 2)
|
||||||
|
}
|
||||||
|
|
||||||
|
[sub_resource type="Animation" id="Animation_lrqmv"]
|
||||||
|
resource_name = "walk"
|
||||||
|
length = 2.0
|
||||||
|
loop_mode = 1
|
||||||
|
tracks/0/type = "bezier"
|
||||||
|
tracks/0/imported = false
|
||||||
|
tracks/0/enabled = true
|
||||||
|
tracks/0/path = NodePath("Camera:position:x")
|
||||||
|
tracks/0/interp = 1
|
||||||
|
tracks/0/loop_wrap = true
|
||||||
|
tracks/0/keys = {
|
||||||
|
"handle_modes": PackedInt32Array(0, 1, 0, 1, 0),
|
||||||
|
"points": PackedFloat32Array(0.04, -0.25, 0, 0.25, 0, 0, 0, 0, 0, 0, -0.04, -0.25, 0, 0.25, 0, 0, 0, 0, 0, 0, 0.04, -0.25, 0, 0.25, 0),
|
||||||
"times": PackedFloat32Array(0, 0.5, 1, 1.5, 2)
|
"times": PackedFloat32Array(0, 0.5, 1, 1.5, 2)
|
||||||
}
|
}
|
||||||
tracks/1/type = "bezier"
|
tracks/1/type = "bezier"
|
||||||
@ -175,22 +228,12 @@ tracks/1/keys = {
|
|||||||
"points": PackedFloat32Array(-0.05, -0.25, 0, 0.2, 0.005, 0, -0.2, 0.000186046, 0.2, 0.000186046, -0.05, -0.2, 0.005, 0.2, 0.005, 0, -0.2, 0, 0.2, 0, -0.05, -0.2, 0.005, 0.25, 0),
|
"points": PackedFloat32Array(-0.05, -0.25, 0, 0.2, 0.005, 0, -0.2, 0.000186046, 0.2, 0.000186046, -0.05, -0.2, 0.005, 0.2, 0.005, 0, -0.2, 0, 0.2, 0, -0.05, -0.2, 0.005, 0.25, 0),
|
||||||
"times": PackedFloat32Array(0, 0.5, 1, 1.5, 2)
|
"times": PackedFloat32Array(0, 0.5, 1, 1.5, 2)
|
||||||
}
|
}
|
||||||
tracks/2/type = "bezier"
|
|
||||||
tracks/2/imported = false
|
|
||||||
tracks/2/enabled = true
|
|
||||||
tracks/2/path = NodePath("Camera:position:z")
|
|
||||||
tracks/2/interp = 1
|
|
||||||
tracks/2/loop_wrap = true
|
|
||||||
tracks/2/keys = {
|
|
||||||
"handle_modes": PackedInt32Array(0, 0, 0, 0, 0),
|
|
||||||
"points": PackedFloat32Array(0, -0.25, 0, 0.25, 0, 0, -0.25, 0, 0.25, 0, 0, -0.25, 0, 0.25, 0, 0, -0.25, 0, 0.25, 0, 0, -0.25, 0, 0.25, 0),
|
|
||||||
"times": PackedFloat32Array(0, 0.5, 1, 1.5, 2)
|
|
||||||
}
|
|
||||||
|
|
||||||
[sub_resource type="AnimationLibrary" id="AnimationLibrary_o0unb"]
|
[sub_resource type="AnimationLibrary" id="AnimationLibrary_o0unb"]
|
||||||
_data = {
|
_data = {
|
||||||
"RESET": SubResource("Animation_gh776"),
|
"RESET": SubResource("Animation_gh776"),
|
||||||
"headbob": SubResource("Animation_lrqmv")
|
"sprint": SubResource("Animation_8ku67"),
|
||||||
|
"walk": SubResource("Animation_lrqmv")
|
||||||
}
|
}
|
||||||
|
|
||||||
[sub_resource type="Animation" id="Animation_fvvjq"]
|
[sub_resource type="Animation" id="Animation_fvvjq"]
|
||||||
@ -205,11 +248,24 @@ tracks/0/keys = {
|
|||||||
"times": PackedFloat32Array(0),
|
"times": PackedFloat32Array(0),
|
||||||
"transitions": PackedFloat32Array(1),
|
"transitions": PackedFloat32Array(1),
|
||||||
"update": 0,
|
"update": 0,
|
||||||
"values": [Vector3(0.0349066, 0, 0)]
|
"values": [Vector3(0, 0, 0)]
|
||||||
|
}
|
||||||
|
tracks/1/type = "value"
|
||||||
|
tracks/1/imported = false
|
||||||
|
tracks/1/enabled = true
|
||||||
|
tracks/1/path = NodePath("Camera:position")
|
||||||
|
tracks/1/interp = 1
|
||||||
|
tracks/1/loop_wrap = true
|
||||||
|
tracks/1/keys = {
|
||||||
|
"times": PackedFloat32Array(0),
|
||||||
|
"transitions": PackedFloat32Array(1),
|
||||||
|
"update": 0,
|
||||||
|
"values": [Vector3(0, 0, 0)]
|
||||||
}
|
}
|
||||||
|
|
||||||
[sub_resource type="Animation" id="Animation_s07ye"]
|
[sub_resource type="Animation" id="Animation_s07ye"]
|
||||||
resource_name = "jump"
|
resource_name = "jump"
|
||||||
|
length = 3.0
|
||||||
tracks/0/type = "value"
|
tracks/0/type = "value"
|
||||||
tracks/0/imported = false
|
tracks/0/imported = false
|
||||||
tracks/0/enabled = true
|
tracks/0/enabled = true
|
||||||
@ -217,14 +273,15 @@ tracks/0/path = NodePath("Camera:rotation")
|
|||||||
tracks/0/interp = 2
|
tracks/0/interp = 2
|
||||||
tracks/0/loop_wrap = true
|
tracks/0/loop_wrap = true
|
||||||
tracks/0/keys = {
|
tracks/0/keys = {
|
||||||
"times": PackedFloat32Array(0, 0.5, 1),
|
"times": PackedFloat32Array(0, 0.6, 3),
|
||||||
"transitions": PackedFloat32Array(1, 1, 1),
|
"transitions": PackedFloat32Array(1, 1, 1),
|
||||||
"update": 0,
|
"update": 0,
|
||||||
"values": [Vector3(0, 0, 0), Vector3(0.0349066, 0, 0), Vector3(0, 0, 0)]
|
"values": [Vector3(0, 0, 0), Vector3(0.0349066, 0, 0), Vector3(0, 0, 0)]
|
||||||
}
|
}
|
||||||
|
|
||||||
[sub_resource type="Animation" id="Animation_vsknp"]
|
[sub_resource type="Animation" id="Animation_l1rph"]
|
||||||
resource_name = "land"
|
resource_name = "land_left"
|
||||||
|
length = 1.5
|
||||||
tracks/0/type = "value"
|
tracks/0/type = "value"
|
||||||
tracks/0/imported = false
|
tracks/0/imported = false
|
||||||
tracks/0/enabled = true
|
tracks/0/enabled = true
|
||||||
@ -232,17 +289,58 @@ tracks/0/path = NodePath("Camera:rotation")
|
|||||||
tracks/0/interp = 2
|
tracks/0/interp = 2
|
||||||
tracks/0/loop_wrap = true
|
tracks/0/loop_wrap = true
|
||||||
tracks/0/keys = {
|
tracks/0/keys = {
|
||||||
"times": PackedFloat32Array(0, 0.5, 1),
|
"times": PackedFloat32Array(0, 0.5, 1.5),
|
||||||
"transitions": PackedFloat32Array(1, 1, 1),
|
"transitions": PackedFloat32Array(1, 1, 1),
|
||||||
"update": 0,
|
"update": 0,
|
||||||
"values": [Vector3(0, 0, 0), Vector3(-0.0349066, 0, 0), Vector3(0, 0, 0)]
|
"values": [Vector3(0, 0, 0), Vector3(-0.0349066, 0, 0.0174533), Vector3(0, 0, 0)]
|
||||||
|
}
|
||||||
|
tracks/1/type = "value"
|
||||||
|
tracks/1/imported = false
|
||||||
|
tracks/1/enabled = true
|
||||||
|
tracks/1/path = NodePath("Camera:position")
|
||||||
|
tracks/1/interp = 1
|
||||||
|
tracks/1/loop_wrap = true
|
||||||
|
tracks/1/keys = {
|
||||||
|
"times": PackedFloat32Array(0, 0.5, 1.5),
|
||||||
|
"transitions": PackedFloat32Array(1, 1, 1),
|
||||||
|
"update": 0,
|
||||||
|
"values": [Vector3(0, 0, 0), Vector3(0, -0.1, 0), Vector3(0, 0, 0)]
|
||||||
|
}
|
||||||
|
|
||||||
|
[sub_resource type="Animation" id="Animation_vsknp"]
|
||||||
|
resource_name = "land_right"
|
||||||
|
length = 1.5
|
||||||
|
tracks/0/type = "value"
|
||||||
|
tracks/0/imported = false
|
||||||
|
tracks/0/enabled = true
|
||||||
|
tracks/0/path = NodePath("Camera:rotation")
|
||||||
|
tracks/0/interp = 2
|
||||||
|
tracks/0/loop_wrap = true
|
||||||
|
tracks/0/keys = {
|
||||||
|
"times": PackedFloat32Array(0, 0.5, 1.5),
|
||||||
|
"transitions": PackedFloat32Array(1, 1, 1),
|
||||||
|
"update": 0,
|
||||||
|
"values": [Vector3(0, 0, 0), Vector3(-0.0349066, 0, -0.0174533), Vector3(0, 0, 0)]
|
||||||
|
}
|
||||||
|
tracks/1/type = "value"
|
||||||
|
tracks/1/imported = false
|
||||||
|
tracks/1/enabled = true
|
||||||
|
tracks/1/path = NodePath("Camera:position")
|
||||||
|
tracks/1/interp = 1
|
||||||
|
tracks/1/loop_wrap = true
|
||||||
|
tracks/1/keys = {
|
||||||
|
"times": PackedFloat32Array(0, 0.5, 1.5),
|
||||||
|
"transitions": PackedFloat32Array(1, 1, 1),
|
||||||
|
"update": 0,
|
||||||
|
"values": [Vector3(0, 0, 0), Vector3(0, -0.1, 0), Vector3(0, 0, 0)]
|
||||||
}
|
}
|
||||||
|
|
||||||
[sub_resource type="AnimationLibrary" id="AnimationLibrary_qeg5r"]
|
[sub_resource type="AnimationLibrary" id="AnimationLibrary_qeg5r"]
|
||||||
_data = {
|
_data = {
|
||||||
"RESET": SubResource("Animation_fvvjq"),
|
"RESET": SubResource("Animation_fvvjq"),
|
||||||
"jump": SubResource("Animation_s07ye"),
|
"jump": SubResource("Animation_s07ye"),
|
||||||
"land": SubResource("Animation_vsknp")
|
"land_left": SubResource("Animation_l1rph"),
|
||||||
|
"land_right": SubResource("Animation_vsknp")
|
||||||
}
|
}
|
||||||
|
|
||||||
[sub_resource type="Theme" id="Theme_wdf0f"]
|
[sub_resource type="Theme" id="Theme_wdf0f"]
|
||||||
@ -255,14 +353,13 @@ MarginContainer/constants/margin_top = 10
|
|||||||
|
|
||||||
[node name="Character" type="CharacterBody3D" node_paths=PackedStringArray("HEAD", "CAMERA", "HEADBOB_ANIMATION", "JUMP_ANIMATION", "CROUCH_ANIMATION", "COLLISION_MESH")]
|
[node name="Character" type="CharacterBody3D" node_paths=PackedStringArray("HEAD", "CAMERA", "HEADBOB_ANIMATION", "JUMP_ANIMATION", "CROUCH_ANIMATION", "COLLISION_MESH")]
|
||||||
script = ExtResource("1_0t4e8")
|
script = ExtResource("1_0t4e8")
|
||||||
|
default_reticle = "res://addons/fpc/reticles/reticle_1.tscn"
|
||||||
HEAD = NodePath("Head")
|
HEAD = NodePath("Head")
|
||||||
CAMERA = NodePath("Head/Camera")
|
CAMERA = NodePath("Head/Camera")
|
||||||
HEADBOB_ANIMATION = NodePath("Head/HeadbobAnimation")
|
HEADBOB_ANIMATION = NodePath("Head/HeadbobAnimation")
|
||||||
JUMP_ANIMATION = NodePath("Head/JumpAnimation")
|
JUMP_ANIMATION = NodePath("Head/JumpAnimation")
|
||||||
CROUCH_ANIMATION = NodePath("CrouchAnimation")
|
CROUCH_ANIMATION = NodePath("CrouchAnimation")
|
||||||
COLLISION_MESH = NodePath("Collision")
|
COLLISION_MESH = NodePath("Collision")
|
||||||
CROUCH = "crouch"
|
|
||||||
SPRINT = "sprint"
|
|
||||||
|
|
||||||
[node name="Mesh" type="MeshInstance3D" parent="."]
|
[node name="Mesh" type="MeshInstance3D" parent="."]
|
||||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1, 0)
|
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1, 0)
|
||||||
@ -281,13 +378,12 @@ libraries = {
|
|||||||
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, 0.999391, -0.0348995, 0, 0.0348995, 0.999391, 0, 0, 0)
|
|
||||||
|
|
||||||
[node name="HeadbobAnimation" type="AnimationPlayer" parent="Head"]
|
[node name="HeadbobAnimation" type="AnimationPlayer" parent="Head"]
|
||||||
libraries = {
|
libraries = {
|
||||||
"": SubResource("AnimationLibrary_o0unb")
|
"": SubResource("AnimationLibrary_o0unb")
|
||||||
}
|
}
|
||||||
blend_times = [&"RESET", &"RESET", 0.5, &"RESET", &"headbob", 0.5, &"headbob", &"RESET", 0.5]
|
blend_times = [&"RESET", &"RESET", 0.5, &"RESET", &"walk", 0.5, &"walk", &"RESET", 0.5]
|
||||||
|
|
||||||
[node name="JumpAnimation" type="AnimationPlayer" parent="Head"]
|
[node name="JumpAnimation" type="AnimationPlayer" parent="Head"]
|
||||||
libraries = {
|
libraries = {
|
||||||
@ -304,11 +400,6 @@ grow_horizontal = 2
|
|||||||
grow_vertical = 2
|
grow_vertical = 2
|
||||||
mouse_filter = 1
|
mouse_filter = 1
|
||||||
|
|
||||||
[node name="Reticle_1" parent="UserInterface" node_paths=PackedStringArray("reticle_lines", "character") instance=ExtResource("2_uuexm")]
|
|
||||||
layout_mode = 1
|
|
||||||
reticle_lines = [NodePath("top"), NodePath("left"), NodePath("right"), NodePath("bottom")]
|
|
||||||
character = NodePath("../..")
|
|
||||||
|
|
||||||
[node name="DebugPanel" type="PanelContainer" parent="UserInterface"]
|
[node name="DebugPanel" type="PanelContainer" parent="UserInterface"]
|
||||||
visible = false
|
visible = false
|
||||||
layout_mode = 0
|
layout_mode = 0
|
||||||
@ -330,4 +421,5 @@ transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1, 0)
|
|||||||
shape = SubResource("SphereShape3D_k4wwl")
|
shape = SubResource("SphereShape3D_k4wwl")
|
||||||
target_position = Vector3(0, 0.5, 0)
|
target_position = Vector3(0, 0.5, 0)
|
||||||
|
|
||||||
[editable path="UserInterface/Reticle_1"]
|
[node name="EditorModule" type="Node" parent="."]
|
||||||
|
script = ExtResource("3_v3ckk")
|
||||||
|
@ -5,11 +5,11 @@ func _process(delta):
|
|||||||
if visible:
|
if visible:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
func add_property(title : String, value, order : int):
|
func add_property(title : String, value, order : int): # This can either be called once for a static property or called every frame for a dynamic property
|
||||||
var target
|
var target
|
||||||
target = $MarginContainer/VBoxContainer.find_child(title, true, false)
|
target = $MarginContainer/VBoxContainer.find_child(title, true, false) # I have no idea what true and false does here, the function should be more specific
|
||||||
if !target:
|
if !target:
|
||||||
target = Label.new()
|
target = Label.new() # Debug lines are of type Label
|
||||||
$MarginContainer/VBoxContainer.add_child(target)
|
$MarginContainer/VBoxContainer.add_child(target)
|
||||||
target.name = title
|
target.name = title
|
||||||
target.text = title + ": " + str(value)
|
target.text = title + ": " + str(value)
|
||||||
|
@ -73,7 +73,7 @@ func update_reticle_settings():
|
|||||||
reticle_lines[3].points[1].y = line_length + line_distance
|
reticle_lines[3].points[1].y = line_length + line_distance
|
||||||
"
|
"
|
||||||
|
|
||||||
[node name="Reticle" type="CenterContainer"]
|
[node name="Reticle" type="CenterContainer" node_paths=PackedStringArray("reticle_lines")]
|
||||||
anchors_preset = 8
|
anchors_preset = 8
|
||||||
anchor_left = 0.5
|
anchor_left = 0.5
|
||||||
anchor_top = 0.5
|
anchor_top = 0.5
|
||||||
@ -82,6 +82,7 @@ anchor_bottom = 0.5
|
|||||||
grow_horizontal = 2
|
grow_horizontal = 2
|
||||||
grow_vertical = 2
|
grow_vertical = 2
|
||||||
script = SubResource("GDScript_a8kpl")
|
script = SubResource("GDScript_a8kpl")
|
||||||
|
reticle_lines = [NodePath("top"), NodePath("left"), NodePath("right"), NodePath("bottom")]
|
||||||
|
|
||||||
[node name="dot" type="Polygon2D" parent="."]
|
[node name="dot" type="Polygon2D" parent="."]
|
||||||
polygon = PackedVector2Array(-1, -1, 1, -1, 1, 1, -1, 1)
|
polygon = PackedVector2Array(-1, -1, 1, -1, 1, 1, -1, 1)
|
||||||
|
Reference in New Issue
Block a user