Initial push
This commit is contained in:
commit
3240f07946
335 changed files with 11248 additions and 0 deletions
2
Scenes/quality-godot-first-person-2-main/.gitattributes
vendored
Normal file
2
Scenes/quality-godot-first-person-2-main/.gitattributes
vendored
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
# Normalize EOL for all files that Git considers text files.
|
||||
* text=auto eol=lf
|
||||
2
Scenes/quality-godot-first-person-2-main/.gitignore
vendored
Normal file
2
Scenes/quality-godot-first-person-2-main/.gitignore
vendored
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
# Godot 4+ specific ignores
|
||||
.godot/
|
||||
21
Scenes/quality-godot-first-person-2-main/LICENSE
Normal file
21
Scenes/quality-godot-first-person-2-main/LICENSE
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
MIT License
|
||||
|
||||
Copyright (c) 2023 Colormatic
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
67
Scenes/quality-godot-first-person-2-main/README.md
Normal file
67
Scenes/quality-godot-first-person-2-main/README.md
Normal file
|
|
@ -0,0 +1,67 @@
|
|||
# quality-godot-first-person-2
|
||||
Actually good first person controller for the Godot Engine.
|
||||
MIT License (credit Colormatic Studios)
|
||||
|
||||
This first person controller was made because there aren't many first person controllers for Godot, and the ones that do exist are pretty bad.
|
||||
It is highly customizable and comes with many features, QOL, and clean code.
|
||||
|
||||
Some parts came from StayAtHomeDev's FPS tutorial. You can find that [here](https://www.youtube.com/playlist?list=PLEHvj4yeNfeF6s-UVs5Zx5TfNYmeCiYwf).
|
||||
|
||||
# Directions
|
||||
Move with WASD, space to jump, shift to sprint, C to crouch.
|
||||
|
||||
**FEATURES:**
|
||||
- Extremely configurable
|
||||
- In-air momentum
|
||||
- Motion smoothing
|
||||
- FOV smoothing
|
||||
- Movement animations
|
||||
- Crouching
|
||||
- Sprinting
|
||||
- 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!
|
||||
|
||||
# Wiki
|
||||
**To start out**, you should probably remap all of the movement keys to your own control set.
|
||||
|
||||
You can make this a super basic controller by just disabling everything.
|
||||
|
||||
**How to add controller/GamePad support**
|
||||
- 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.
|
||||
- Write in these keymaps in the controls section of the player settings.
|
||||
- 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.)
|
||||
|
||||
**Slope/staircase:**
|
||||
Credit to [roberto-urbani23](https://github.com/roberto-urbani23)
|
||||
In the character inspector, you can uncheck Stop on Slope and set the max angle to 89 (for some reason, 90 will make the player stuck). Also Snap Length to 1 otherwise your character will not remain attached to stairs if you sprint while going downstairs.
|
||||
|
||||
**How to change settings:**
|
||||
Click on the character node and there should be settings in the "Feature Settings" group.
|
||||
|
||||
**How to add animations for a mesh:**
|
||||
- Create a function for your animation and attach it to `_physics_process` to call it every frame.
|
||||
- Use `input_dir` as a boolean (it is actually a `Vector2`) to know if the player is walking.
|
||||
- Use the `state` member variable to tell if the player is sprinting or crouching.
|
||||
- Use the `is_on_floor` function to tell if the player is standing or falling.
|
||||
|
||||
**How to change reticles (crosshairs):**
|
||||
Change the "Default Reticle" setting to your reticle file.
|
||||
During runtime:
|
||||
Use the `change_reticle` function on the character.
|
||||
|
||||
**How to create a new reticle:**
|
||||
- Choose a reticle to base it off of.
|
||||
- Open that reticle and save it as a new reticle.
|
||||
- Remove the script from the reticle and create a new one. (for some reason you have to do this)
|
||||
- Edit the reticle to your needs.
|
||||
- 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
|
||||
|
|
@ -0,0 +1,49 @@
|
|||
@tool
|
||||
extends Node
|
||||
|
||||
# This does not effect runtime yet but will in the future.
|
||||
|
||||
@export_category("Controller Editor Module")
|
||||
@export_range(-360.0, 360.0, 0.01, "or_greater", "or_less") var head_y_rotation : float = 0.0:
|
||||
set(new_rotation):
|
||||
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" # 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
|
||||
|
||||
@onready var HEAD = get_node("../" + head_path)
|
||||
|
||||
|
||||
func _ready():
|
||||
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 _get_configuration_warnings():
|
||||
var warnings = []
|
||||
|
||||
if head_y_rotation > 360:
|
||||
warnings.append("The head rotation is greater than 360")
|
||||
|
||||
if head_y_rotation < -360:
|
||||
warnings.append("The head rotation is less than -360")
|
||||
|
||||
# Returning an empty array gives no warnings
|
||||
return warnings
|
||||
488
Scenes/quality-godot-first-person-2-main/addons/fpc/character.gd
Normal file
488
Scenes/quality-godot-first-person-2-main/addons/fpc/character.gd
Normal file
|
|
@ -0,0 +1,488 @@
|
|||
# COPYRIGHT Colormatic Studios
|
||||
# MIT license
|
||||
# Quality Godot First Person Controller v2
|
||||
|
||||
|
||||
extends CharacterBody3D
|
||||
|
||||
|
||||
#region Character Export Group
|
||||
|
||||
## The settings for the character's movement and feel.
|
||||
@export_category("Character")
|
||||
## The speed that the character moves at without crouching or sprinting.
|
||||
@export var base_speed : float = 3.0
|
||||
## The speed that the character moves at when sprinting.
|
||||
@export var sprint_speed : float = 6.0
|
||||
## The speed that the character moves at when crouching.
|
||||
@export var crouch_speed : float = 1.0
|
||||
|
||||
## How fast the character speeds up and slows down when Motion Smoothing is on.
|
||||
@export var acceleration : float = 10.0
|
||||
## How high the player jumps.
|
||||
@export var jump_velocity : float = 4.5
|
||||
## How far the player turns when the mouse is moved.
|
||||
@export var mouse_sensitivity : float = 0.1
|
||||
## Invert the X axis input for the camera.
|
||||
@export var invert_camera_x_axis : bool = false
|
||||
## Invert the Y axis input for the camera.
|
||||
@export var invert_camera_y_axis : bool = false
|
||||
## Whether the player can use movement inputs. Does not stop outside forces or jumping. See Jumping Enabled.
|
||||
@export var immobile : bool = false
|
||||
## The reticle file to import at runtime. By default are in res://addons/fpc/reticles/. Set to an empty string to remove.
|
||||
@export_file var default_reticle
|
||||
|
||||
#endregion
|
||||
|
||||
#region Nodes Export Group
|
||||
|
||||
@export_group("Nodes")
|
||||
## A reference to the camera for use in the character script. This is the parent node to the camera and is rotated instead of the camera for mouse input.
|
||||
@export var HEAD : Node3D
|
||||
## A reference to the camera for use in the character script.
|
||||
@export var CAMERA : Camera3D
|
||||
## A reference to the headbob animation for use in the character script.
|
||||
@export var HEADBOB_ANIMATION : AnimationPlayer
|
||||
## A reference to the jump animation for use in the character script.
|
||||
@export var JUMP_ANIMATION : AnimationPlayer
|
||||
## A reference to the crouch animation for use in the character script.
|
||||
@export var CROUCH_ANIMATION : AnimationPlayer
|
||||
## A reference to the the player's collision shape for use in the character script.
|
||||
@export var COLLISION_MESH : CollisionShape3D
|
||||
|
||||
#endregion
|
||||
|
||||
#region Controls Export Group
|
||||
|
||||
# We are using UI controls because they are built into Godot Engine so they can be used right away
|
||||
@export_group("Controls")
|
||||
## Use the Input Map to map a mouse/keyboard input to an action and add a reference to it to this dictionary to be used in the script.
|
||||
@export var controls : Dictionary = {
|
||||
LEFT = "ui_left",
|
||||
RIGHT = "ui_right",
|
||||
FORWARD = "ui_up",
|
||||
BACKWARD = "ui_down",
|
||||
JUMP = "ui_accept",
|
||||
CROUCH = "crouch",
|
||||
SPRINT = "sprint",
|
||||
PAUSE = "ui_cancel"
|
||||
}
|
||||
@export_subgroup("Controller Specific")
|
||||
## This only affects how the camera is handled, the rest should be covered by adding controller inputs to the existing actions in the Input Map.
|
||||
@export var controller_support : bool = false
|
||||
## Use the Input Map to map a controller input to an action and add a reference to it to this dictionary to be used in the script.
|
||||
@export var controller_controls : Dictionary = {
|
||||
LOOK_LEFT = "look_left",
|
||||
LOOK_RIGHT = "look_right",
|
||||
LOOK_UP = "look_up",
|
||||
LOOK_DOWN = "look_down"
|
||||
}
|
||||
## The sensitivity of the analog stick that controls camera rotation. Lower is less sensitive and higher is more sensitive.
|
||||
@export_range(0.001, 1, 0.001) var look_sensitivity : float = 0.035
|
||||
|
||||
#endregion
|
||||
|
||||
#region Feature Settings Export Group
|
||||
|
||||
@export_group("Feature Settings")
|
||||
## Enable or disable jumping. Useful for restrictive storytelling environments.
|
||||
@export var jumping_enabled : bool = true
|
||||
## Whether the player can move in the air or not.
|
||||
@export var in_air_momentum : bool = true
|
||||
## Smooths the feel of walking.
|
||||
@export var motion_smoothing : bool = true
|
||||
## Enables or disables sprinting.
|
||||
@export var sprint_enabled : bool = true
|
||||
## Toggles the sprinting state when button is pressed or requires the player to hold the button down to remain sprinting.
|
||||
@export_enum("Hold to Sprint", "Toggle Sprint") var sprint_mode : int = 0
|
||||
## Enables or disables crouching.
|
||||
@export var crouch_enabled : bool = true
|
||||
## Toggles the crouch state when button is pressed or requires the player to hold the button down to remain crouched.
|
||||
@export_enum("Hold to Crouch", "Toggle Crouch") var crouch_mode : int = 0
|
||||
## Wether sprinting should effect FOV.
|
||||
@export var dynamic_fov : bool = true
|
||||
## If the player holds down the jump button, should the player keep hopping.
|
||||
@export var continuous_jumping : bool = true
|
||||
## Enables the view bobbing animation.
|
||||
@export var view_bobbing : bool = true
|
||||
## Enables an immersive animation when the player jumps and hits the ground.
|
||||
@export var jump_animation : bool = true
|
||||
## This determines wether the player can use the pause button, not wether the game will actually pause.
|
||||
@export var pausing_enabled : bool = true
|
||||
## Use with caution.
|
||||
@export var gravity_enabled : bool = true
|
||||
## If your game changes the gravity value during gameplay, check this property to allow the player to experience the change in gravity.
|
||||
@export var dynamic_gravity : bool = false
|
||||
|
||||
#endregion
|
||||
|
||||
#region Member Variable Initialization
|
||||
|
||||
# These are variables used in this script that don't need to be exposed in the editor.
|
||||
var speed : float = base_speed
|
||||
var current_speed : float = 0.0
|
||||
# States: normal, crouching, sprinting
|
||||
var state : String = "normal"
|
||||
var low_ceiling : bool = false # This is for when the ceiling is too low and the player needs to crouch.
|
||||
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
|
||||
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 physics process
|
||||
var mouseInput : Vector2 = Vector2(0,0)
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
|
||||
#region Main Control Flow
|
||||
|
||||
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
|
||||
|
||||
# If the controller is rotated in a certain direction for game design purposes, redirect this rotation into the head.
|
||||
HEAD.rotation.y = rotation.y
|
||||
rotation.y = 0
|
||||
|
||||
if default_reticle:
|
||||
change_reticle(default_reticle)
|
||||
|
||||
initialize_animations()
|
||||
check_controls()
|
||||
enter_normal_state()
|
||||
|
||||
|
||||
func _process(_delta):
|
||||
if pausing_enabled:
|
||||
handle_pausing()
|
||||
|
||||
update_debug_menu_per_frame()
|
||||
|
||||
|
||||
func _physics_process(delta): # Most things happen here.
|
||||
# Gravity
|
||||
if dynamic_gravity:
|
||||
gravity = ProjectSettings.get_setting("physics/3d/default_gravity")
|
||||
if not is_on_floor() and gravity and gravity_enabled:
|
||||
velocity.y -= gravity * delta
|
||||
|
||||
handle_jumping()
|
||||
|
||||
var input_dir = Vector2.ZERO
|
||||
|
||||
if not immobile: # Immobility works by interrupting user input, so other forces can still be applied to the player
|
||||
input_dir = Input.get_vector(controls.LEFT, controls.RIGHT, controls.FORWARD, controls.BACKWARD)
|
||||
|
||||
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()
|
||||
|
||||
handle_state(input_dir)
|
||||
if dynamic_fov: # This may be changed to an AnimationPlayer
|
||||
update_camera_fov()
|
||||
|
||||
if view_bobbing:
|
||||
play_headbob_animation(input_dir)
|
||||
|
||||
if jump_animation:
|
||||
play_jump_animation()
|
||||
|
||||
update_debug_menu_per_tick()
|
||||
|
||||
was_on_floor = is_on_floor() # This must always be at the end of physics_process
|
||||
|
||||
#endregion
|
||||
|
||||
#region Input Handling
|
||||
|
||||
func handle_jumping():
|
||||
if jumping_enabled:
|
||||
if continuous_jumping: # Hold down the jump button
|
||||
if Input.is_action_pressed(controls.JUMP) and is_on_floor() and !low_ceiling:
|
||||
if jump_animation:
|
||||
JUMP_ANIMATION.play("jump", 0.25)
|
||||
velocity.y += jump_velocity # Adding instead of setting so jumping on slopes works properly
|
||||
else:
|
||||
if Input.is_action_just_pressed(controls.JUMP) and is_on_floor() and !low_ceiling:
|
||||
if jump_animation:
|
||||
JUMP_ANIMATION.play("jump", 0.25)
|
||||
velocity.y += jump_velocity
|
||||
|
||||
|
||||
func handle_movement(delta, input_dir):
|
||||
var direction = input_dir.rotated(-HEAD.rotation.y)
|
||||
direction = Vector3(direction.x, 0, direction.y)
|
||||
move_and_slide()
|
||||
|
||||
if in_air_momentum:
|
||||
if is_on_floor():
|
||||
if motion_smoothing:
|
||||
velocity.x = lerp(velocity.x, direction.x * speed, acceleration * delta)
|
||||
velocity.z = lerp(velocity.z, direction.z * speed, acceleration * delta)
|
||||
else:
|
||||
velocity.x = direction.x * speed
|
||||
velocity.z = direction.z * speed
|
||||
else:
|
||||
if motion_smoothing:
|
||||
velocity.x = lerp(velocity.x, direction.x * speed, acceleration * delta)
|
||||
velocity.z = lerp(velocity.z, direction.z * speed, acceleration * delta)
|
||||
else:
|
||||
velocity.x = direction.x * speed
|
||||
velocity.z = direction.z * speed
|
||||
|
||||
|
||||
func handle_head_rotation():
|
||||
if invert_camera_x_axis:
|
||||
HEAD.rotation_degrees.y -= mouseInput.x * mouse_sensitivity * -1
|
||||
else:
|
||||
HEAD.rotation_degrees.y -= mouseInput.x * mouse_sensitivity
|
||||
|
||||
if invert_camera_y_axis:
|
||||
HEAD.rotation_degrees.x -= mouseInput.y * mouse_sensitivity * -1
|
||||
else:
|
||||
HEAD.rotation_degrees.x -= mouseInput.y * mouse_sensitivity
|
||||
|
||||
if controller_support:
|
||||
var controller_view_rotation = Input.get_vector(controller_controls.LOOK_DOWN, controller_controls.LOOK_UP, controller_controls.LOOK_RIGHT, controller_controls.LOOK_LEFT) * look_sensitivity # These are inverted because of the nature of 3D rotation.
|
||||
if invert_camera_x_axis:
|
||||
HEAD.rotation.x += controller_view_rotation.x * -1
|
||||
else:
|
||||
HEAD.rotation.x += controller_view_rotation.x
|
||||
|
||||
if invert_camera_y_axis:
|
||||
HEAD.rotation.y += controller_view_rotation.y * -1
|
||||
else:
|
||||
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 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(controls.JUMP):
|
||||
push_error("No control mapped for jumping. Please add an input map control. Disabling jump.")
|
||||
jumping_enabled = false
|
||||
if !InputMap.has_action(controls.LEFT):
|
||||
push_error("No control mapped for move left. Please add an input map control. Disabling movement.")
|
||||
immobile = true
|
||||
if !InputMap.has_action(controls.RIGHT):
|
||||
push_error("No control mapped for move right. Please add an input map control. Disabling movement.")
|
||||
immobile = true
|
||||
if !InputMap.has_action(controls.FORWARD):
|
||||
push_error("No control mapped for move forward. Please add an input map control. Disabling movement.")
|
||||
immobile = true
|
||||
if !InputMap.has_action(controls.BACKWARD):
|
||||
push_error("No control mapped for move backward. Please add an input map control. Disabling movement.")
|
||||
immobile = true
|
||||
if !InputMap.has_action(controls.PAUSE):
|
||||
push_error("No control mapped for pause. Please add an input map control. Disabling pausing.")
|
||||
pausing_enabled = false
|
||||
if !InputMap.has_action(controls.CROUCH):
|
||||
push_error("No control mapped for crouch. Please add an input map control. Disabling crouching.")
|
||||
crouch_enabled = false
|
||||
if !InputMap.has_action(controls.SPRINT):
|
||||
push_error("No control mapped for sprint. Please add an input map control. Disabling sprinting.")
|
||||
sprint_enabled = false
|
||||
|
||||
#endregion
|
||||
|
||||
#region State Handling
|
||||
|
||||
func handle_state(moving):
|
||||
if sprint_enabled:
|
||||
if sprint_mode == 0:
|
||||
if Input.is_action_pressed(controls.SPRINT) and state != "crouching":
|
||||
if moving:
|
||||
if state != "sprinting":
|
||||
enter_sprint_state()
|
||||
else:
|
||||
if state == "sprinting":
|
||||
enter_normal_state()
|
||||
elif state == "sprinting":
|
||||
enter_normal_state()
|
||||
elif sprint_mode == 1:
|
||||
if moving:
|
||||
# If the player is holding sprint before moving, handle that scenario
|
||||
if Input.is_action_pressed(controls.SPRINT) and state == "normal":
|
||||
enter_sprint_state()
|
||||
if Input.is_action_just_pressed(controls.SPRINT):
|
||||
match state:
|
||||
"normal":
|
||||
enter_sprint_state()
|
||||
"sprinting":
|
||||
enter_normal_state()
|
||||
elif state == "sprinting":
|
||||
enter_normal_state()
|
||||
|
||||
if crouch_enabled:
|
||||
if crouch_mode == 0:
|
||||
if Input.is_action_pressed(controls.CROUCH) and state != "sprinting":
|
||||
if state != "crouching":
|
||||
enter_crouch_state()
|
||||
elif state == "crouching" and !$CrouchCeilingDetection.is_colliding():
|
||||
enter_normal_state()
|
||||
elif crouch_mode == 1:
|
||||
if Input.is_action_just_pressed(controls.CROUCH):
|
||||
match state:
|
||||
"normal":
|
||||
enter_crouch_state()
|
||||
"crouching":
|
||||
if !$CrouchCeilingDetection.is_colliding():
|
||||
enter_normal_state()
|
||||
|
||||
|
||||
# Any enter state function should only be called once when you want to enter that state, not every frame.
|
||||
func enter_normal_state():
|
||||
#print("entering normal state")
|
||||
var prev_state = state
|
||||
if prev_state == "crouching":
|
||||
CROUCH_ANIMATION.play_backwards("crouch")
|
||||
state = "normal"
|
||||
speed = base_speed
|
||||
|
||||
func enter_crouch_state():
|
||||
#print("entering crouch state")
|
||||
state = "crouching"
|
||||
speed = crouch_speed
|
||||
CROUCH_ANIMATION.play("crouch")
|
||||
|
||||
func enter_sprint_state():
|
||||
#print("entering sprint state")
|
||||
var prev_state = state
|
||||
if prev_state == "crouching":
|
||||
CROUCH_ANIMATION.play_backwards("crouch")
|
||||
state = "sprinting"
|
||||
speed = sprint_speed
|
||||
|
||||
#endregion
|
||||
|
||||
#region Animation Handling
|
||||
|
||||
func initialize_animations():
|
||||
# Reset the camera position
|
||||
# If you want to change the default head height, change these animations.
|
||||
HEADBOB_ANIMATION.play("RESET")
|
||||
JUMP_ANIMATION.play("RESET")
|
||||
CROUCH_ANIMATION.play("RESET")
|
||||
|
||||
func play_headbob_animation(moving):
|
||||
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
|
||||
if HEADBOB_ANIMATION.current_animation == use_headbob_animation:
|
||||
was_playing = true
|
||||
|
||||
HEADBOB_ANIMATION.play(use_headbob_animation, 0.25)
|
||||
HEADBOB_ANIMATION.speed_scale = (current_speed / base_speed) * 1.75
|
||||
if !was_playing:
|
||||
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.
|
||||
# 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.
|
||||
# This code is extremely performant but it makes no sense.
|
||||
|
||||
else:
|
||||
if HEADBOB_ANIMATION.current_animation == "sprint" or HEADBOB_ANIMATION.current_animation == "walk":
|
||||
HEADBOB_ANIMATION.speed_scale = 1
|
||||
HEADBOB_ANIMATION.play("RESET", 1)
|
||||
|
||||
func play_jump_animation():
|
||||
if !was_on_floor and is_on_floor(): # The player just landed
|
||||
var facing_direction : Vector3 = CAMERA.get_global_transform().basis.x
|
||||
var facing_direction_2D : Vector2 = Vector2(facing_direction.x, facing_direction.z).normalized()
|
||||
var velocity_2D : Vector2 = Vector2(velocity.x, velocity.z).normalized()
|
||||
|
||||
# Compares velocity direction against the camera direction (via dot product) to determine which landing animation to play.
|
||||
var side_landed : int = round(velocity_2D.dot(facing_direction_2D))
|
||||
|
||||
if side_landed > 0:
|
||||
JUMP_ANIMATION.play("land_right", 0.25)
|
||||
elif side_landed < 0:
|
||||
JUMP_ANIMATION.play("land_left", 0.25)
|
||||
else:
|
||||
JUMP_ANIMATION.play("land_center", 0.25)
|
||||
|
||||
#endregion
|
||||
|
||||
#region Debug Menu
|
||||
|
||||
func update_debug_menu_per_frame():
|
||||
$UserInterface/DebugPanel.add_property("FPS", Performance.get_monitor(Performance.TIME_FPS), 0)
|
||||
var status : String = state
|
||||
if !is_on_floor():
|
||||
status += " in the air"
|
||||
$UserInterface/DebugPanel.add_property("State", status, 4)
|
||||
|
||||
|
||||
func update_debug_menu_per_tick():
|
||||
# Big thanks to github.com/LorenzoAncora for the concept of the improved debug values
|
||||
current_speed = Vector3.ZERO.distance_to(get_real_velocity())
|
||||
$UserInterface/DebugPanel.add_property("Speed", snappedf(current_speed, 0.001), 1)
|
||||
$UserInterface/DebugPanel.add_property("Target speed", speed, 2)
|
||||
var cv : Vector3 = get_real_velocity()
|
||||
var vd : Array[float] = [
|
||||
snappedf(cv.x, 0.001),
|
||||
snappedf(cv.y, 0.001),
|
||||
snappedf(cv.z, 0.001)
|
||||
]
|
||||
var readable_velocity : String = "X: " + str(vd[0]) + " Y: " + str(vd[1]) + " Z: " + str(vd[2])
|
||||
$UserInterface/DebugPanel.add_property("Velocity", readable_velocity, 3)
|
||||
|
||||
|
||||
func _unhandled_input(event : InputEvent):
|
||||
if event is InputEventMouseMotion and Input.mouse_mode == Input.MOUSE_MODE_CAPTURED:
|
||||
mouseInput.x += event.relative.x
|
||||
mouseInput.y += event.relative.y
|
||||
# Toggle debug menu
|
||||
elif event is InputEventKey:
|
||||
if event.is_released():
|
||||
# Where we're going, we don't need InputMap
|
||||
if event.keycode == 4194338: # F7
|
||||
$UserInterface/DebugPanel.visible = !$UserInterface/DebugPanel.visible
|
||||
|
||||
#endregion
|
||||
|
||||
#region Misc Functions
|
||||
|
||||
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 update_camera_fov():
|
||||
if state == "sprinting":
|
||||
CAMERA.fov = lerp(CAMERA.fov, 85.0, 0.3)
|
||||
else:
|
||||
CAMERA.fov = lerp(CAMERA.fov, 75.0, 0.3)
|
||||
|
||||
func handle_pausing():
|
||||
if Input.is_action_just_pressed(controls.PAUSE):
|
||||
# You may want another node to handle pausing, because this player may get paused too.
|
||||
match Input.mouse_mode:
|
||||
Input.MOUSE_MODE_CAPTURED:
|
||||
Input.mouse_mode = Input.MOUSE_MODE_VISIBLE
|
||||
#get_tree().paused = false
|
||||
Input.MOUSE_MODE_VISIBLE:
|
||||
Input.mouse_mode = Input.MOUSE_MODE_CAPTURED
|
||||
#get_tree().paused = false
|
||||
|
||||
#endregion
|
||||
|
|
@ -0,0 +1,455 @@
|
|||
[gd_scene load_steps=22 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/EditorModule.gd" id="3_v3ckk"]
|
||||
[ext_resource type="Script" path="res://addons/fpc/debug.gd" id="3_x1wcc"]
|
||||
|
||||
[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_kp17n"]
|
||||
albedo_color = Color(0.909804, 0.596078, 0, 1)
|
||||
clearcoat_enabled = true
|
||||
clearcoat_roughness = 0.2
|
||||
|
||||
[sub_resource type="CapsuleMesh" id="CapsuleMesh_jw1de"]
|
||||
material = SubResource("StandardMaterial3D_kp17n")
|
||||
|
||||
[sub_resource type="CapsuleShape3D" id="CapsuleShape3D_uy03j"]
|
||||
|
||||
[sub_resource type="Animation" id="Animation_j8cx7"]
|
||||
resource_name = "RESET"
|
||||
length = 0.001
|
||||
tracks/0/type = "value"
|
||||
tracks/0/imported = false
|
||||
tracks/0/enabled = true
|
||||
tracks/0/path = NodePath("Mesh:position")
|
||||
tracks/0/interp = 2
|
||||
tracks/0/loop_wrap = true
|
||||
tracks/0/keys = {
|
||||
"times": PackedFloat32Array(0),
|
||||
"transitions": PackedFloat32Array(1),
|
||||
"update": 0,
|
||||
"values": [Vector3(0, 1, 0)]
|
||||
}
|
||||
tracks/1/type = "value"
|
||||
tracks/1/imported = false
|
||||
tracks/1/enabled = true
|
||||
tracks/1/path = NodePath("Collision:position")
|
||||
tracks/1/interp = 2
|
||||
tracks/1/loop_wrap = true
|
||||
tracks/1/keys = {
|
||||
"times": PackedFloat32Array(0),
|
||||
"transitions": PackedFloat32Array(1),
|
||||
"update": 0,
|
||||
"values": [Vector3(0, 1, 0)]
|
||||
}
|
||||
tracks/2/type = "value"
|
||||
tracks/2/imported = false
|
||||
tracks/2/enabled = true
|
||||
tracks/2/path = NodePath("Head: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.5, 0)]
|
||||
}
|
||||
tracks/3/type = "value"
|
||||
tracks/3/imported = false
|
||||
tracks/3/enabled = true
|
||||
tracks/3/path = NodePath("Mesh:mesh:height")
|
||||
tracks/3/interp = 1
|
||||
tracks/3/loop_wrap = true
|
||||
tracks/3/keys = {
|
||||
"times": PackedFloat32Array(0),
|
||||
"transitions": PackedFloat32Array(1),
|
||||
"update": 0,
|
||||
"values": [2.0]
|
||||
}
|
||||
tracks/4/type = "value"
|
||||
tracks/4/imported = false
|
||||
tracks/4/enabled = true
|
||||
tracks/4/path = NodePath("Collision:shape:height")
|
||||
tracks/4/interp = 1
|
||||
tracks/4/loop_wrap = true
|
||||
tracks/4/keys = {
|
||||
"times": PackedFloat32Array(0),
|
||||
"transitions": PackedFloat32Array(1),
|
||||
"update": 0,
|
||||
"values": [2.0]
|
||||
}
|
||||
|
||||
[sub_resource type="Animation" id="Animation_5ec5e"]
|
||||
resource_name = "crouch"
|
||||
length = 0.2
|
||||
tracks/0/type = "value"
|
||||
tracks/0/imported = false
|
||||
tracks/0/enabled = true
|
||||
tracks/0/path = NodePath("Mesh:position")
|
||||
tracks/0/interp = 2
|
||||
tracks/0/loop_wrap = true
|
||||
tracks/0/keys = {
|
||||
"times": PackedFloat32Array(0, 0.2),
|
||||
"transitions": PackedFloat32Array(1, 1),
|
||||
"update": 0,
|
||||
"values": [Vector3(0, 1, 0), Vector3(0, 0.75, 0)]
|
||||
}
|
||||
tracks/1/type = "value"
|
||||
tracks/1/imported = false
|
||||
tracks/1/enabled = true
|
||||
tracks/1/path = NodePath("Collision:position")
|
||||
tracks/1/interp = 2
|
||||
tracks/1/loop_wrap = true
|
||||
tracks/1/keys = {
|
||||
"times": PackedFloat32Array(0, 0.2),
|
||||
"transitions": PackedFloat32Array(1, 1),
|
||||
"update": 0,
|
||||
"values": [Vector3(0, 1, 0), Vector3(0, 0.75, 0)]
|
||||
}
|
||||
tracks/2/type = "value"
|
||||
tracks/2/imported = false
|
||||
tracks/2/enabled = true
|
||||
tracks/2/path = NodePath("Head:position")
|
||||
tracks/2/interp = 2
|
||||
tracks/2/loop_wrap = true
|
||||
tracks/2/keys = {
|
||||
"times": PackedFloat32Array(0, 0.2),
|
||||
"transitions": PackedFloat32Array(1, 1),
|
||||
"update": 0,
|
||||
"values": [Vector3(0, 1.5, 0), Vector3(0, 1.12508, 0)]
|
||||
}
|
||||
tracks/3/type = "value"
|
||||
tracks/3/imported = false
|
||||
tracks/3/enabled = true
|
||||
tracks/3/path = NodePath("Mesh:mesh:height")
|
||||
tracks/3/interp = 2
|
||||
tracks/3/loop_wrap = true
|
||||
tracks/3/keys = {
|
||||
"times": PackedFloat32Array(0, 0.2),
|
||||
"transitions": PackedFloat32Array(1, 1),
|
||||
"update": 0,
|
||||
"values": [2.0, 1.5]
|
||||
}
|
||||
tracks/4/type = "value"
|
||||
tracks/4/imported = false
|
||||
tracks/4/enabled = true
|
||||
tracks/4/path = NodePath("Collision:shape:height")
|
||||
tracks/4/interp = 2
|
||||
tracks/4/loop_wrap = true
|
||||
tracks/4/keys = {
|
||||
"times": PackedFloat32Array(0, 0.2),
|
||||
"transitions": PackedFloat32Array(1, 1),
|
||||
"update": 0,
|
||||
"values": [2.0, 1.5]
|
||||
}
|
||||
|
||||
[sub_resource type="AnimationLibrary" id="AnimationLibrary_5e5t5"]
|
||||
_data = {
|
||||
"RESET": SubResource("Animation_j8cx7"),
|
||||
"crouch": SubResource("Animation_5ec5e")
|
||||
}
|
||||
|
||||
[sub_resource type="Animation" id="Animation_gh776"]
|
||||
resource_name = "RESET"
|
||||
length = 0.001
|
||||
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),
|
||||
"points": PackedFloat32Array(0, -0.25, 0, 0.25, 0),
|
||||
"times": PackedFloat32Array(0)
|
||||
}
|
||||
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),
|
||||
"points": PackedFloat32Array(0, -0.25, 0, 0.25, 0),
|
||||
"times": PackedFloat32Array(0)
|
||||
}
|
||||
|
||||
[sub_resource type="Animation" id="Animation_8ku67"]
|
||||
resource_name = "sprint"
|
||||
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.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),
|
||||
"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)
|
||||
}
|
||||
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),
|
||||
"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)
|
||||
}
|
||||
|
||||
[sub_resource type="AnimationLibrary" id="AnimationLibrary_o0unb"]
|
||||
_data = {
|
||||
"RESET": SubResource("Animation_gh776"),
|
||||
"sprint": SubResource("Animation_8ku67"),
|
||||
"walk": SubResource("Animation_lrqmv")
|
||||
}
|
||||
|
||||
[sub_resource type="Animation" id="Animation_fvvjq"]
|
||||
length = 0.001
|
||||
tracks/0/type = "value"
|
||||
tracks/0/imported = false
|
||||
tracks/0/enabled = true
|
||||
tracks/0/path = NodePath("Camera:rotation")
|
||||
tracks/0/interp = 1
|
||||
tracks/0/loop_wrap = true
|
||||
tracks/0/keys = {
|
||||
"times": PackedFloat32Array(0),
|
||||
"transitions": PackedFloat32Array(1),
|
||||
"update": 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"]
|
||||
resource_name = "jump"
|
||||
length = 3.0
|
||||
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.6, 3),
|
||||
"transitions": PackedFloat32Array(1, 1, 1),
|
||||
"update": 0,
|
||||
"values": [Vector3(0, 0, 0), Vector3(0.0349066, 0, 0), Vector3(0, 0, 0)]
|
||||
}
|
||||
|
||||
[sub_resource type="Animation" id="Animation_3eyjl"]
|
||||
resource_name = "land_center"
|
||||
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), 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_l1rph"]
|
||||
resource_name = "land_left"
|
||||
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="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"]
|
||||
_data = {
|
||||
"RESET": SubResource("Animation_fvvjq"),
|
||||
"jump": SubResource("Animation_s07ye"),
|
||||
"land_center": SubResource("Animation_3eyjl"),
|
||||
"land_left": SubResource("Animation_l1rph"),
|
||||
"land_right": SubResource("Animation_vsknp")
|
||||
}
|
||||
|
||||
[sub_resource type="Theme" id="Theme_wdf0f"]
|
||||
MarginContainer/constants/margin_bottom = 10
|
||||
MarginContainer/constants/margin_left = 10
|
||||
MarginContainer/constants/margin_right = 10
|
||||
MarginContainer/constants/margin_top = 10
|
||||
|
||||
[sub_resource type="SphereShape3D" id="SphereShape3D_k4wwl"]
|
||||
|
||||
[node name="Character" type="CharacterBody3D" node_paths=PackedStringArray("HEAD", "CAMERA", "HEADBOB_ANIMATION", "JUMP_ANIMATION", "CROUCH_ANIMATION", "COLLISION_MESH")]
|
||||
transform = Transform3D(-4.37114e-08, 0, -1, 0, 1, 0, 1, 0, -4.37114e-08, 0, 0, 0)
|
||||
script = ExtResource("1_0t4e8")
|
||||
default_reticle = "res://addons/fpc/reticles/reticle_1.tscn"
|
||||
HEAD = NodePath("Head")
|
||||
CAMERA = NodePath("Head/Camera")
|
||||
HEADBOB_ANIMATION = NodePath("Head/HeadbobAnimation")
|
||||
JUMP_ANIMATION = NodePath("Head/JumpAnimation")
|
||||
CROUCH_ANIMATION = NodePath("CrouchAnimation")
|
||||
COLLISION_MESH = NodePath("Collision")
|
||||
|
||||
[node name="Mesh" type="MeshInstance3D" parent="."]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1, 0)
|
||||
mesh = SubResource("CapsuleMesh_jw1de")
|
||||
|
||||
[node name="Collision" type="CollisionShape3D" parent="."]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1, 0)
|
||||
shape = SubResource("CapsuleShape3D_uy03j")
|
||||
|
||||
[node name="CrouchAnimation" type="AnimationPlayer" parent="."]
|
||||
libraries = {
|
||||
"": SubResource("AnimationLibrary_5e5t5")
|
||||
}
|
||||
|
||||
[node name="Head" type="Node3D" parent="."]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1.5, 0)
|
||||
|
||||
[node name="Camera" type="Camera3D" parent="Head"]
|
||||
|
||||
[node name="HeadbobAnimation" type="AnimationPlayer" parent="Head"]
|
||||
libraries = {
|
||||
"": SubResource("AnimationLibrary_o0unb")
|
||||
}
|
||||
blend_times = [&"RESET", &"RESET", 0.5, &"RESET", &"walk", 0.5, &"walk", &"RESET", 0.5]
|
||||
|
||||
[node name="JumpAnimation" type="AnimationPlayer" parent="Head"]
|
||||
libraries = {
|
||||
"": SubResource("AnimationLibrary_qeg5r")
|
||||
}
|
||||
speed_scale = 4.0
|
||||
|
||||
[node name="UserInterface" type="Control" parent="."]
|
||||
layout_mode = 3
|
||||
anchors_preset = 15
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
mouse_filter = 1
|
||||
|
||||
[node name="DebugPanel" type="PanelContainer" parent="UserInterface"]
|
||||
visible = false
|
||||
layout_mode = 0
|
||||
offset_left = 10.0
|
||||
offset_top = 10.0
|
||||
offset_right = 453.0
|
||||
offset_bottom = 50.0
|
||||
theme = SubResource("Theme_wdf0f")
|
||||
script = ExtResource("3_x1wcc")
|
||||
|
||||
[node name="MarginContainer" type="MarginContainer" parent="UserInterface/DebugPanel"]
|
||||
layout_mode = 2
|
||||
|
||||
[node name="VBoxContainer" type="VBoxContainer" parent="UserInterface/DebugPanel/MarginContainer"]
|
||||
layout_mode = 2
|
||||
|
||||
[node name="CrouchCeilingDetection" type="ShapeCast3D" parent="."]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1, 0)
|
||||
shape = SubResource("SphereShape3D_k4wwl")
|
||||
target_position = Vector3(0, 0.5, 0)
|
||||
|
||||
[node name="EditorModule" type="Node" parent="."]
|
||||
script = ExtResource("3_v3ckk")
|
||||
18
Scenes/quality-godot-first-person-2-main/addons/fpc/debug.gd
Normal file
18
Scenes/quality-godot-first-person-2-main/addons/fpc/debug.gd
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
extends PanelContainer
|
||||
|
||||
|
||||
func _process(delta):
|
||||
if visible:
|
||||
pass
|
||||
|
||||
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
|
||||
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:
|
||||
target = Label.new() # Debug lines are of type Label
|
||||
$MarginContainer/VBoxContainer.add_child(target)
|
||||
target.name = title
|
||||
target.text = title + ": " + str(value)
|
||||
elif visible:
|
||||
target.text = title + ": " + str(value)
|
||||
$MarginContainer/VBoxContainer.move_child(target, order)
|
||||
|
|
@ -0,0 +1,37 @@
|
|||
[gd_scene load_steps=2 format=3 uid="uid://coqpusufa8a6k"]
|
||||
|
||||
[sub_resource type="GDScript" id="GDScript_10f85"]
|
||||
script/source = "extends CenterContainer
|
||||
|
||||
|
||||
@export_category(\"Reticle\")
|
||||
@export_group(\"Nodes\")
|
||||
@export var character : CharacterBody3D
|
||||
|
||||
@export_group(\"Settings\")
|
||||
@export var dot_size : int = 1
|
||||
@export var dot_color : Color = Color.WHITE
|
||||
|
||||
|
||||
func _process(_delta):
|
||||
if visible: # If the reticle is disabled (not visible), don't bother updating it
|
||||
update_reticle_settings()
|
||||
|
||||
func update_reticle_settings():
|
||||
$dot.scale.x = dot_size
|
||||
$dot.scale.y = dot_size
|
||||
$dot.color = dot_color
|
||||
"
|
||||
|
||||
[node name="Reticle" type="CenterContainer"]
|
||||
anchors_preset = 8
|
||||
anchor_left = 0.5
|
||||
anchor_top = 0.5
|
||||
anchor_right = 0.5
|
||||
anchor_bottom = 0.5
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
script = SubResource("GDScript_10f85")
|
||||
|
||||
[node name="dot" type="Polygon2D" parent="."]
|
||||
polygon = PackedVector2Array(-1, -1, 1, -1, 1, 1, -1, 1)
|
||||
|
|
@ -0,0 +1,104 @@
|
|||
[gd_scene load_steps=2 format=3 uid="uid://3mij3cjhkwsm"]
|
||||
|
||||
[sub_resource type="GDScript" id="GDScript_a8kpl"]
|
||||
script/source = "extends CenterContainer
|
||||
|
||||
|
||||
@export_category(\"Reticle\")
|
||||
@export_group(\"Nodes\")
|
||||
@export var reticle_lines : Array[Line2D]
|
||||
@export var character : CharacterBody3D
|
||||
|
||||
@export_group(\"Animate\")
|
||||
@export var animated_reticle : bool = true
|
||||
@export var reticle_speed : float = 0.5
|
||||
@export var reticle_spread : float = 4.0
|
||||
|
||||
@export_group(\"Dot Settings\")
|
||||
@export var dot_size : int = 1
|
||||
@export var dot_color : Color = Color.WHITE
|
||||
|
||||
@export_group(\"Line Settings\")
|
||||
@export var line_color : Color = Color.WHITE
|
||||
@export var line_width : int = 2
|
||||
@export var line_length : int = 10
|
||||
@export var line_distance : int = 5
|
||||
@export_enum(\"None\", \"Round\") var cap_mode : int = 0
|
||||
|
||||
|
||||
func _process(_delta):
|
||||
if visible: # If the reticle is disabled (not visible), don't bother updating it
|
||||
update_reticle_settings()
|
||||
if animated_reticle:
|
||||
animate_reticle_lines()
|
||||
|
||||
|
||||
func animate_reticle_lines():
|
||||
var vel = character.get_real_velocity()
|
||||
var origin = Vector3(0,0,0)
|
||||
var pos = Vector2(0,0)
|
||||
var speed = origin.distance_to(vel)
|
||||
|
||||
reticle_lines[0].position = lerp(reticle_lines[0].position, pos + Vector2(0, -speed * reticle_spread), reticle_speed)
|
||||
reticle_lines[1].position = lerp(reticle_lines[1].position, pos + Vector2(-speed * reticle_spread, 0), reticle_speed)
|
||||
reticle_lines[2].position = lerp(reticle_lines[2].position, pos + Vector2(speed * reticle_spread, 0), reticle_speed)
|
||||
reticle_lines[3].position = lerp(reticle_lines[3].position, pos + Vector2(0, speed * reticle_spread), reticle_speed)
|
||||
|
||||
|
||||
func update_reticle_settings():
|
||||
# Dot
|
||||
$dot.scale.x = dot_size
|
||||
$dot.scale.y = dot_size
|
||||
$dot.color = dot_color
|
||||
|
||||
# Lines
|
||||
for line in reticle_lines:
|
||||
line.default_color = line_color
|
||||
line.width = line_width
|
||||
if cap_mode == 0:
|
||||
line.begin_cap_mode = Line2D.LINE_CAP_NONE
|
||||
line.end_cap_mode = Line2D.LINE_CAP_NONE
|
||||
elif cap_mode == 1:
|
||||
line.begin_cap_mode = Line2D.LINE_CAP_ROUND
|
||||
line.end_cap_mode = Line2D.LINE_CAP_ROUND
|
||||
|
||||
# Please someone find a better way to do this
|
||||
reticle_lines[0].points[0].y = -line_distance
|
||||
reticle_lines[0].points[1].y = -line_length - line_distance
|
||||
reticle_lines[1].points[0].x = -line_distance
|
||||
reticle_lines[1].points[1].x = -line_length - line_distance
|
||||
reticle_lines[2].points[0].x = line_distance
|
||||
reticle_lines[2].points[1].x = line_length + line_distance
|
||||
reticle_lines[3].points[0].y = line_distance
|
||||
reticle_lines[3].points[1].y = line_length + line_distance
|
||||
"
|
||||
|
||||
[node name="Reticle" type="CenterContainer" node_paths=PackedStringArray("reticle_lines")]
|
||||
anchors_preset = 8
|
||||
anchor_left = 0.5
|
||||
anchor_top = 0.5
|
||||
anchor_right = 0.5
|
||||
anchor_bottom = 0.5
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
script = SubResource("GDScript_a8kpl")
|
||||
reticle_lines = [NodePath("top"), NodePath("left"), NodePath("right"), NodePath("bottom")]
|
||||
|
||||
[node name="dot" type="Polygon2D" parent="."]
|
||||
polygon = PackedVector2Array(-1, -1, 1, -1, 1, 1, -1, 1)
|
||||
|
||||
[node name="top" type="Line2D" parent="."]
|
||||
points = PackedVector2Array(0, -5, 0, -15)
|
||||
width = 2.0
|
||||
|
||||
[node name="left" type="Line2D" parent="."]
|
||||
points = PackedVector2Array(-5, 0, -15, 0)
|
||||
width = 2.0
|
||||
|
||||
[node name="right" type="Line2D" parent="."]
|
||||
points = PackedVector2Array(5, 0, 15, 0)
|
||||
width = 2.0
|
||||
|
||||
[node name="bottom" type="Line2D" parent="."]
|
||||
points = PackedVector2Array(0, 5, 0, 15)
|
||||
width = 2.0
|
||||
126
Scenes/quality-godot-first-person-2-main/icon.svg
Normal file
126
Scenes/quality-godot-first-person-2-main/icon.svg
Normal file
|
|
@ -0,0 +1,126 @@
|
|||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<!-- Created with Inkscape (http://www.inkscape.org/) -->
|
||||
|
||||
<svg
|
||||
width="150"
|
||||
height="150"
|
||||
viewBox="0 0 39.6875 39.6875"
|
||||
version="1.1"
|
||||
id="svg5"
|
||||
inkscape:version="1.2.2 (b0a8486541, 2022-12-01)"
|
||||
sodipodi:docname="fpc.svg"
|
||||
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
|
||||
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
xmlns:svg="http://www.w3.org/2000/svg">
|
||||
<sodipodi:namedview
|
||||
id="namedview7"
|
||||
pagecolor="#ffffff"
|
||||
bordercolor="#000000"
|
||||
borderopacity="0.25"
|
||||
inkscape:showpageshadow="2"
|
||||
inkscape:pageopacity="0.0"
|
||||
inkscape:pagecheckerboard="0"
|
||||
inkscape:deskcolor="#d1d1d1"
|
||||
inkscape:document-units="px"
|
||||
showgrid="false"
|
||||
inkscape:zoom="2.2556397"
|
||||
inkscape:cx="59.849983"
|
||||
inkscape:cy="91.769974"
|
||||
inkscape:window-width="1920"
|
||||
inkscape:window-height="999"
|
||||
inkscape:window-x="0"
|
||||
inkscape:window-y="0"
|
||||
inkscape:window-maximized="1"
|
||||
inkscape:current-layer="layer1" />
|
||||
<defs
|
||||
id="defs2">
|
||||
<inkscape:path-effect
|
||||
effect="fillet_chamfer"
|
||||
id="path-effect1744"
|
||||
is_visible="true"
|
||||
lpeversion="1"
|
||||
nodesatellites_param="F,0,0,1,0,1,0,1 @ F,0,0,1,0,1,0,1 @ F,0,0,1,0,1,0,1 @ F,0,0,1,0,1,0,1"
|
||||
unit="px"
|
||||
method="auto"
|
||||
mode="F"
|
||||
radius="1"
|
||||
chamfer_steps="1"
|
||||
flexible="false"
|
||||
use_knot_distance="true"
|
||||
apply_no_radius="true"
|
||||
apply_with_radius="true"
|
||||
only_selected="false"
|
||||
hide_knots="false" />
|
||||
<inkscape:path-effect
|
||||
effect="fillet_chamfer"
|
||||
id="path-effect1684"
|
||||
is_visible="true"
|
||||
lpeversion="1"
|
||||
nodesatellites_param="F,0,0,1,0,1,0,1 @ F,0,0,1,0,1,0,1 @ F,0,0,1,0,1,0,1 @ F,0,0,1,0,1,0,1"
|
||||
unit="px"
|
||||
method="auto"
|
||||
mode="F"
|
||||
radius="1"
|
||||
chamfer_steps="1"
|
||||
flexible="false"
|
||||
use_knot_distance="true"
|
||||
apply_no_radius="true"
|
||||
apply_with_radius="true"
|
||||
only_selected="false"
|
||||
hide_knots="false" />
|
||||
</defs>
|
||||
<g
|
||||
inkscape:label="Layer 1"
|
||||
inkscape:groupmode="layer"
|
||||
id="layer1">
|
||||
<g
|
||||
id="g1864"
|
||||
transform="translate(6.6145833)">
|
||||
<path
|
||||
id="path111"
|
||||
style="fill:#00ff00;stroke-width:0.272479"
|
||||
d="m 13.22917,1.013838 a 8.842373,9.1893035 0 0 0 -8.8423797,9.18931 v 20.296451 a 8.842373,9.1893035 0 0 0 8.8423797,9.18931 8.842373,9.1893035 0 0 0 8.842378,-9.18931 V 10.203148 A 8.842373,9.1893035 0 0 0 13.22917,1.013838 Z" />
|
||||
<path
|
||||
style="fill:none;stroke:#e95d22;stroke-width:0.529167;stroke-dasharray:none;stroke-opacity:1"
|
||||
id="rect279"
|
||||
width="25.913443"
|
||||
height="16.566221"
|
||||
x="0.27244532"
|
||||
y="0.27244532"
|
||||
inkscape:path-effect="#path-effect1684"
|
||||
d="M 1.2724453,0.27244532 H 25.185888 a 1,1 45 0 1 1,0.99999998 V 15.838667 a 1,1 135 0 1 -1,1 H 1.2724453 a 1,1 45 0 1 -0.99999998,-1 V 1.2724453 A 1,1 135 0 1 1.2724453,0.27244532 Z"
|
||||
sodipodi:type="rect" />
|
||||
<path
|
||||
style="fill:none;stroke:#e95d22;stroke-width:0.529167;stroke-dasharray:none;stroke-opacity:1"
|
||||
id="path1740"
|
||||
width="11.417918"
|
||||
height="7.2993684"
|
||||
x="7.520205"
|
||||
y="4.9058709"
|
||||
inkscape:path-effect="#path-effect1744"
|
||||
d="m 8.520205,4.9058709 h 9.417918 a 1,1 45 0 1 1,1 v 5.2993681 a 1,1 135 0 1 -1,1 H 8.520205 a 1,1 45 0 1 -1,-1 V 5.9058709 a 1,1 135 0 1 1,-1 z"
|
||||
sodipodi:type="rect" />
|
||||
<path
|
||||
style="fill:#00ff00;stroke:#e95d22;stroke-width:0.54496;stroke-dasharray:none;stroke-opacity:1"
|
||||
d="M 7.7862338,5.2457481 0.50634941,0.65050091"
|
||||
id="path1800"
|
||||
sodipodi:nodetypes="cc" />
|
||||
<path
|
||||
style="fill:#00ff00;stroke:#e95d22;stroke-width:0.54496;stroke-dasharray:none;stroke-opacity:1"
|
||||
d="m 7.7346532,11.802129 -7.28316966,4.58339"
|
||||
id="path1802"
|
||||
sodipodi:nodetypes="cc" />
|
||||
<path
|
||||
style="fill:#00ff00;stroke:#e95d22;stroke-width:0.54496;stroke-dasharray:none;stroke-opacity:1"
|
||||
d="m 18.612374,11.927532 7.378151,4.481829"
|
||||
id="path1804"
|
||||
sodipodi:nodetypes="cc" />
|
||||
<path
|
||||
style="fill:#00ff00;stroke:#e95d22;stroke-width:0.54496;stroke-dasharray:none;stroke-opacity:1"
|
||||
d="M 18.665843,5.2387351 25.953925,0.65293238"
|
||||
id="path1806"
|
||||
sodipodi:nodetypes="cc" />
|
||||
</g>
|
||||
</g>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 4.5 KiB |
37
Scenes/quality-godot-first-person-2-main/icon.svg.import
Normal file
37
Scenes/quality-godot-first-person-2-main/icon.svg.import
Normal file
|
|
@ -0,0 +1,37 @@
|
|||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="CompressedTexture2D"
|
||||
uid="uid://64npoko7rqya"
|
||||
path="res://.godot/imported/icon.svg-218a8f2b3041327d8a5756f3a245f83b.ctex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://icon.svg"
|
||||
dest_files=["res://.godot/imported/icon.svg-218a8f2b3041327d8a5756f3a245f83b.ctex"]
|
||||
|
||||
[params]
|
||||
|
||||
compress/mode=0
|
||||
compress/high_quality=false
|
||||
compress/lossy_quality=0.7
|
||||
compress/hdr_compression=1
|
||||
compress/normal_map=0
|
||||
compress/channel_pack=0
|
||||
mipmaps/generate=false
|
||||
mipmaps/limit=-1
|
||||
roughness/mode=0
|
||||
roughness/src_normal=""
|
||||
process/fix_alpha_border=true
|
||||
process/premult_alpha=false
|
||||
process/normal_map_invert_y=false
|
||||
process/hdr_as_srgb=false
|
||||
process/hdr_clamp_exposure=false
|
||||
process/size_limit=0
|
||||
detect_3d/compress_to=1
|
||||
svg/scale=1.0
|
||||
editor/scale_with_editor_scale=false
|
||||
editor/convert_colors_with_editor_theme=false
|
||||
65
Scenes/quality-godot-first-person-2-main/project.godot
Normal file
65
Scenes/quality-godot-first-person-2-main/project.godot
Normal file
|
|
@ -0,0 +1,65 @@
|
|||
; Engine configuration file.
|
||||
; It's best edited using the editor UI and not directly,
|
||||
; since the parameters that go here are not all obvious.
|
||||
;
|
||||
; Format:
|
||||
; [section] ; section goes between []
|
||||
; param=value ; assign values to parameters
|
||||
|
||||
config_version=5
|
||||
|
||||
[application]
|
||||
|
||||
config/name="first person controller 2.0"
|
||||
run/main_scene="res://test_world.tscn"
|
||||
config/features=PackedStringArray("4.3", "Forward Plus")
|
||||
config/icon="res://icon.svg"
|
||||
|
||||
[display]
|
||||
|
||||
window/size/mode=2
|
||||
|
||||
[input]
|
||||
|
||||
ui_left={
|
||||
"deadzone": 0.5,
|
||||
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":4194319,"physical_keycode":0,"key_label":0,"unicode":0,"location":0,"echo":false,"script":null)
|
||||
, Object(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":0,"button_index":13,"pressure":0.0,"pressed":false,"script":null)
|
||||
, Object(InputEventJoypadMotion,"resource_local_to_scene":false,"resource_name":"","device":0,"axis":0,"axis_value":-1.0,"script":null)
|
||||
, Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":65,"key_label":0,"unicode":97,"location":0,"echo":false,"script":null)
|
||||
]
|
||||
}
|
||||
ui_right={
|
||||
"deadzone": 0.5,
|
||||
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":4194321,"physical_keycode":0,"key_label":0,"unicode":0,"location":0,"echo":false,"script":null)
|
||||
, Object(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":0,"button_index":14,"pressure":0.0,"pressed":false,"script":null)
|
||||
, Object(InputEventJoypadMotion,"resource_local_to_scene":false,"resource_name":"","device":0,"axis":0,"axis_value":1.0,"script":null)
|
||||
, Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":68,"key_label":0,"unicode":100,"location":0,"echo":false,"script":null)
|
||||
]
|
||||
}
|
||||
ui_up={
|
||||
"deadzone": 0.5,
|
||||
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":4194320,"physical_keycode":0,"key_label":0,"unicode":0,"location":0,"echo":false,"script":null)
|
||||
, Object(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":0,"button_index":11,"pressure":0.0,"pressed":false,"script":null)
|
||||
, Object(InputEventJoypadMotion,"resource_local_to_scene":false,"resource_name":"","device":0,"axis":1,"axis_value":-1.0,"script":null)
|
||||
, Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":87,"key_label":0,"unicode":119,"location":0,"echo":false,"script":null)
|
||||
]
|
||||
}
|
||||
ui_down={
|
||||
"deadzone": 0.5,
|
||||
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":4194322,"physical_keycode":0,"key_label":0,"unicode":0,"location":0,"echo":false,"script":null)
|
||||
, Object(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":0,"button_index":12,"pressure":0.0,"pressed":false,"script":null)
|
||||
, Object(InputEventJoypadMotion,"resource_local_to_scene":false,"resource_name":"","device":0,"axis":1,"axis_value":1.0,"script":null)
|
||||
, Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":83,"key_label":0,"unicode":115,"location":0,"echo":false,"script":null)
|
||||
]
|
||||
}
|
||||
crouch={
|
||||
"deadzone": 0.5,
|
||||
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":67,"key_label":0,"unicode":99,"location":0,"echo":false,"script":null)
|
||||
]
|
||||
}
|
||||
sprint={
|
||||
"deadzone": 0.5,
|
||||
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":4194325,"key_label":0,"unicode":0,"location":0,"echo":false,"script":null)
|
||||
]
|
||||
}
|
||||
106
Scenes/quality-godot-first-person-2-main/test_world.tscn
Normal file
106
Scenes/quality-godot-first-person-2-main/test_world.tscn
Normal file
|
|
@ -0,0 +1,106 @@
|
|||
[gd_scene load_steps=15 format=3 uid="uid://cs4drhmc1bql5"]
|
||||
|
||||
[ext_resource type="PackedScene" uid="uid://cc1m2a1obsyn4" path="res://addons/fpc/character.tscn" id="1_e18vq"]
|
||||
[ext_resource type="Texture2D" uid="uid://pe7a4weirj2g" path="res://textures/dark.png" id="2_08fdt"]
|
||||
[ext_resource type="Texture2D" uid="uid://cxjxvqmf4boxq" path="res://textures/green.png" id="3_q4clv"]
|
||||
[ext_resource type="Texture2D" uid="uid://dsv4jm4vydflb" path="res://textures/orange.png" id="4_1ns5t"]
|
||||
|
||||
[sub_resource type="PhysicalSkyMaterial" id="PhysicalSkyMaterial_edcox"]
|
||||
ground_color = Color(0.160784, 0.815686, 0.905882, 1)
|
||||
|
||||
[sub_resource type="Sky" id="Sky_2iust"]
|
||||
sky_material = SubResource("PhysicalSkyMaterial_edcox")
|
||||
|
||||
[sub_resource type="Environment" id="Environment_20rw3"]
|
||||
background_mode = 2
|
||||
sky = SubResource("Sky_2iust")
|
||||
tonemap_mode = 1
|
||||
ssao_enabled = true
|
||||
|
||||
[sub_resource type="Gradient" id="Gradient_ur0vy"]
|
||||
colors = PackedColorArray(0, 0.476245, 0.0193456, 1, 0.360494, 0.612721, 0.119744, 1)
|
||||
|
||||
[sub_resource type="FastNoiseLite" id="FastNoiseLite_jd3pw"]
|
||||
frequency = 0.0027
|
||||
|
||||
[sub_resource type="NoiseTexture2D" id="NoiseTexture2D_7akuf"]
|
||||
width = 1024
|
||||
height = 1024
|
||||
in_3d_space = true
|
||||
seamless = true
|
||||
color_ramp = SubResource("Gradient_ur0vy")
|
||||
noise = SubResource("FastNoiseLite_jd3pw")
|
||||
|
||||
[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_67ysu"]
|
||||
albedo_texture = SubResource("NoiseTexture2D_7akuf")
|
||||
uv1_scale = Vector3(0.1, 0.1, 0.1)
|
||||
uv1_triplanar = true
|
||||
|
||||
[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_gomnb"]
|
||||
albedo_texture = ExtResource("2_08fdt")
|
||||
metallic = 0.81
|
||||
metallic_specular = 0.2
|
||||
roughness = 0.5
|
||||
uv1_triplanar = true
|
||||
uv1_triplanar_sharpness = 0.000850145
|
||||
|
||||
[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_u0sbk"]
|
||||
albedo_texture = ExtResource("3_q4clv")
|
||||
metallic = 0.81
|
||||
metallic_specular = 0.2
|
||||
roughness = 0.5
|
||||
uv1_triplanar = true
|
||||
uv1_triplanar_sharpness = 0.000850145
|
||||
|
||||
[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_7j4uu"]
|
||||
albedo_texture = ExtResource("4_1ns5t")
|
||||
metallic = 0.81
|
||||
metallic_specular = 0.2
|
||||
roughness = 0.5
|
||||
uv1_triplanar = true
|
||||
uv1_triplanar_sharpness = 0.000850145
|
||||
|
||||
[node name="test_world" type="Node3D"]
|
||||
|
||||
[node name="Character" parent="." instance=ExtResource("1_e18vq")]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1, 0)
|
||||
|
||||
[node name="WorldEnvironment" type="WorldEnvironment" parent="."]
|
||||
environment = SubResource("Environment_20rw3")
|
||||
|
||||
[node name="sun" type="DirectionalLight3D" parent="."]
|
||||
transform = Transform3D(0.87959, -0.436605, 0.188936, 0, 0.397148, 0.917755, -0.475732, -0.807248, 0.349328, 0, 0, 0)
|
||||
light_energy = 2.0
|
||||
shadow_enabled = true
|
||||
|
||||
[node name="terrain" type="Node3D" parent="."]
|
||||
|
||||
[node name="CSGBox3D" type="CSGBox3D" parent="terrain"]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 10, -0.5, 10)
|
||||
use_collision = true
|
||||
size = Vector3(30, 1, 30)
|
||||
material = SubResource("StandardMaterial3D_67ysu")
|
||||
|
||||
[node name="CSGBox3D2" type="CSGBox3D" parent="terrain"]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, -0.5, -10)
|
||||
use_collision = true
|
||||
size = Vector3(10, 1, 10)
|
||||
material = SubResource("StandardMaterial3D_gomnb")
|
||||
|
||||
[node name="CSGBox3D3" type="CSGBox3D" parent="terrain"]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -3, 1.8, -13)
|
||||
use_collision = true
|
||||
size = Vector3(4, 0.5, 4)
|
||||
material = SubResource("StandardMaterial3D_gomnb")
|
||||
|
||||
[node name="CSGBox3D4" type="CSGBox3D" parent="terrain"]
|
||||
transform = Transform3D(0.939693, 0.34202, 0, -0.34202, 0.939693, 0, 0, 0, 1, -9.5, 1.2, -10)
|
||||
use_collision = true
|
||||
size = Vector3(10, 1, 10)
|
||||
material = SubResource("StandardMaterial3D_u0sbk")
|
||||
|
||||
[node name="CSGBox3D5" type="CSGBox3D" parent="terrain"]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -4.5, 3, -15.5)
|
||||
use_collision = true
|
||||
size = Vector3(19, 8, 1)
|
||||
material = SubResource("StandardMaterial3D_7j4uu")
|
||||
BIN
Scenes/quality-godot-first-person-2-main/textures/dark.png
Normal file
BIN
Scenes/quality-godot-first-person-2-main/textures/dark.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 2.7 KiB |
|
|
@ -0,0 +1,35 @@
|
|||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="CompressedTexture2D"
|
||||
uid="uid://pe7a4weirj2g"
|
||||
path.s3tc="res://.godot/imported/dark.png-6d46f668c80e231a58e570df85aad257.s3tc.ctex"
|
||||
metadata={
|
||||
"imported_formats": ["s3tc_bptc"],
|
||||
"vram_texture": true
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://textures/dark.png"
|
||||
dest_files=["res://.godot/imported/dark.png-6d46f668c80e231a58e570df85aad257.s3tc.ctex"]
|
||||
|
||||
[params]
|
||||
|
||||
compress/mode=2
|
||||
compress/high_quality=false
|
||||
compress/lossy_quality=0.7
|
||||
compress/hdr_compression=1
|
||||
compress/normal_map=0
|
||||
compress/channel_pack=0
|
||||
mipmaps/generate=true
|
||||
mipmaps/limit=-1
|
||||
roughness/mode=0
|
||||
roughness/src_normal=""
|
||||
process/fix_alpha_border=true
|
||||
process/premult_alpha=false
|
||||
process/normal_map_invert_y=false
|
||||
process/hdr_as_srgb=false
|
||||
process/hdr_clamp_exposure=false
|
||||
process/size_limit=0
|
||||
detect_3d/compress_to=0
|
||||
BIN
Scenes/quality-godot-first-person-2-main/textures/green.png
Normal file
BIN
Scenes/quality-godot-first-person-2-main/textures/green.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 2.7 KiB |
|
|
@ -0,0 +1,35 @@
|
|||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="CompressedTexture2D"
|
||||
uid="uid://cxjxvqmf4boxq"
|
||||
path.s3tc="res://.godot/imported/green.png-b4f8ddc6b00d4e627f0e027e2e1193bf.s3tc.ctex"
|
||||
metadata={
|
||||
"imported_formats": ["s3tc_bptc"],
|
||||
"vram_texture": true
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://textures/green.png"
|
||||
dest_files=["res://.godot/imported/green.png-b4f8ddc6b00d4e627f0e027e2e1193bf.s3tc.ctex"]
|
||||
|
||||
[params]
|
||||
|
||||
compress/mode=2
|
||||
compress/high_quality=false
|
||||
compress/lossy_quality=0.7
|
||||
compress/hdr_compression=1
|
||||
compress/normal_map=0
|
||||
compress/channel_pack=0
|
||||
mipmaps/generate=true
|
||||
mipmaps/limit=-1
|
||||
roughness/mode=0
|
||||
roughness/src_normal=""
|
||||
process/fix_alpha_border=true
|
||||
process/premult_alpha=false
|
||||
process/normal_map_invert_y=false
|
||||
process/hdr_as_srgb=false
|
||||
process/hdr_clamp_exposure=false
|
||||
process/size_limit=0
|
||||
detect_3d/compress_to=0
|
||||
BIN
Scenes/quality-godot-first-person-2-main/textures/orange.png
Normal file
BIN
Scenes/quality-godot-first-person-2-main/textures/orange.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 2.7 KiB |
|
|
@ -0,0 +1,35 @@
|
|||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="CompressedTexture2D"
|
||||
uid="uid://dsv4jm4vydflb"
|
||||
path.s3tc="res://.godot/imported/orange.png-6785d3f8216fd22318e8ea839823715b.s3tc.ctex"
|
||||
metadata={
|
||||
"imported_formats": ["s3tc_bptc"],
|
||||
"vram_texture": true
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://textures/orange.png"
|
||||
dest_files=["res://.godot/imported/orange.png-6785d3f8216fd22318e8ea839823715b.s3tc.ctex"]
|
||||
|
||||
[params]
|
||||
|
||||
compress/mode=2
|
||||
compress/high_quality=false
|
||||
compress/lossy_quality=0.7
|
||||
compress/hdr_compression=1
|
||||
compress/normal_map=0
|
||||
compress/channel_pack=0
|
||||
mipmaps/generate=true
|
||||
mipmaps/limit=-1
|
||||
roughness/mode=0
|
||||
roughness/src_normal=""
|
||||
process/fix_alpha_border=true
|
||||
process/premult_alpha=false
|
||||
process/normal_map_invert_y=false
|
||||
process/hdr_as_srgb=false
|
||||
process/hdr_clamp_exposure=false
|
||||
process/size_limit=0
|
||||
detect_3d/compress_to=0
|
||||
BIN
Scenes/quality-godot-first-person-2-main/textures/purple.png
Normal file
BIN
Scenes/quality-godot-first-person-2-main/textures/purple.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 2.7 KiB |
|
|
@ -0,0 +1,34 @@
|
|||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="CompressedTexture2D"
|
||||
uid="uid://cl4kewig3pk7s"
|
||||
path="res://.godot/imported/purple.png-23488e84f4f0a47488be2c78494f2155.ctex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://textures/purple.png"
|
||||
dest_files=["res://.godot/imported/purple.png-23488e84f4f0a47488be2c78494f2155.ctex"]
|
||||
|
||||
[params]
|
||||
|
||||
compress/mode=0
|
||||
compress/high_quality=false
|
||||
compress/lossy_quality=0.7
|
||||
compress/hdr_compression=1
|
||||
compress/normal_map=0
|
||||
compress/channel_pack=0
|
||||
mipmaps/generate=false
|
||||
mipmaps/limit=-1
|
||||
roughness/mode=0
|
||||
roughness/src_normal=""
|
||||
process/fix_alpha_border=true
|
||||
process/premult_alpha=false
|
||||
process/normal_map_invert_y=false
|
||||
process/hdr_as_srgb=false
|
||||
process/hdr_clamp_exposure=false
|
||||
process/size_limit=0
|
||||
detect_3d/compress_to=1
|
||||
BIN
Scenes/quality-godot-first-person-2-main/textures/red.png
Normal file
BIN
Scenes/quality-godot-first-person-2-main/textures/red.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 2.7 KiB |
|
|
@ -0,0 +1,34 @@
|
|||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="CompressedTexture2D"
|
||||
uid="uid://d1h161t0v6hau"
|
||||
path="res://.godot/imported/red.png-3cad0ca19141406d60f5fd2311159a86.ctex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://textures/red.png"
|
||||
dest_files=["res://.godot/imported/red.png-3cad0ca19141406d60f5fd2311159a86.ctex"]
|
||||
|
||||
[params]
|
||||
|
||||
compress/mode=0
|
||||
compress/high_quality=false
|
||||
compress/lossy_quality=0.7
|
||||
compress/hdr_compression=1
|
||||
compress/normal_map=0
|
||||
compress/channel_pack=0
|
||||
mipmaps/generate=false
|
||||
mipmaps/limit=-1
|
||||
roughness/mode=0
|
||||
roughness/src_normal=""
|
||||
process/fix_alpha_border=true
|
||||
process/premult_alpha=false
|
||||
process/normal_map_invert_y=false
|
||||
process/hdr_as_srgb=false
|
||||
process/hdr_clamp_exposure=false
|
||||
process/size_limit=0
|
||||
detect_3d/compress_to=1
|
||||
Loading…
Add table
Add a link
Reference in a new issue