Git Product home page Git Product logo

godot-4-3d-third-person-controller's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

godot-4-3d-third-person-controller's Issues

HitBox/HurtBox

Not really an issue, just a question, why is this project not using hitbox/hurtbox nodes? I understand that maybe because it's a "small" project, so it's not required, but it would've been good to have it just for learning purpose.

Change algorithm to calculate grenade launch

  • Rewrite grenade launch algorithm to be easier to read
  • Simplify camera code in grenade launcher
  • Remove unnecessary functions in camera controller
  • Rename AimController
  • Make curve path aim based on camera ray
  • Snap target position to enemy collider
  • Fix aim sprite orientation or draw aim sprite as a 2D overlay? Or 3D object? Sprite tends to intersect with the world
  • Game feel: curve should go up faster when aiming up, grenade should launch further if looking/firing up

Parser Error: Cannot infer the type of "next_location" variable because the value doesn't have a set type.

This error occurs on the latest download from the package on MacOS.

Anyone know how do you fix this type error?

Line 39:Cannot infer the type of "next_location" variable because the value doesn't have a set type.
Line 42:Cannot infer the type of "direction" variable because the value doesn't have a set type.

39		var next_location := _navigation_agent.get_next_location() // *** RED
		
		if not _navigation_agent.is_target_reached():
42			var direction := (next_location - global_position) // *** RED
			direction.y = 0
			direction = direction.normalized()

Pressing "Esc" twice, pauses the game but doesn't show any menu

Using Godot 4.0 stable on Windows 10.

If you are on the pause menu, and you press the "Esc" key twice very fast, the game will unpause and pause again very fast, but won't show the menu. So the game will be paused, but you won't be able to see the pause the menu. Pressing "Esc" again after this behaviour will unpause the game again without any issues, and the game will keep to behave normally.

2023-06-06.17-37-06.mp4

[Tracker] Improvements and fixes to improve the demo

Higher priority:

  • Make the character throw grenades in the character's look direction when not in aim mode
  • #14
  • Add a more fitting audio soundtrack
  • Limit the rate of shooting (both grenade and rifle)
  • Make shooting with the rifle continuous when holding the left mouse button down
  • Bug: The jump pad does not always work

Lower priority:

  • The punch attack would benefit from having two animations
  • Add an aiming animation and make the character aim their arm where they're looking
  • Add a reticle when aiming with the gun
  • The coins should have an easing when moving to the character

Known issue: beetle animations are broken in beta 17

EDIT: the project was updated to beta 17 in #13

Now, most animations work fine. Only the beetle's animation tree doesn't play well.


In Godot 4 beta 10 animations don't work properly, Godot's throwing this error:

image

EDIT: this error is fixed, but animations still don't work as intended. We recommend using beta 7/8 until this is fixed

Set all objects to use default layers and masks

Using a variety of layers and masks adds a dependency to anyone looking to reuse the character, and a kind of hidden way in which the character works for Godot beginners (NB: people can be Godot beginners AND experienced developers).

We talked about using multiple layers VS not and to make the demo a bit more accessible and the character a bit easier to copy into new projects, we decided to go with a single layer and mask, as it's easier for people to change later and tailor to their project.

Tasks:

  • Make everything work on physics layer and mask
  • Document this choice

Missing textures in Linux CI export

Description: Missing textures in Linux/X11 version. Most likely related to shaders.
Game version: linux-x11-main-1.0.0-e99f017
OS: Debian GNU/Linux 11 (bullseye) x86_64
Log: godot.log

Screenshot_2023-01-29_18-18-07

Add dedicated sound effects

  • Beefy bullet sound
  • Grenade throw
  • Grenade explosion
  • Impact sounds on enemies
  • Impact sounds on other materials
  • Enemy death (special impact sound, as in e.g. Zelda BoTW?)
  • Cloud puff (enemy death particles)
  • Player step sounds
    • Soil
    • Grass
    • Metal (for jump pads)
  • Player jump
  • Player land

Camera rotation speed is effected by framerate.

I'd like to see the camera rotation improved in GDQuest's third-person controller. Currently, it's affected by framerate. If you turn off VSync and set max fps to 1000 (or another high number) then if you get around 400 FPS (try an empty scene) you can see the camera rotation speed become very slow. Likewise limiting to 10 FPS will speed up the camera rotation.

I noticed you multiply the rotation_input by the delta time of the physics process. This doesn't do anything though since the physics process function is fairly statically called. If you place the code to move the camera in the _process then the delta is representative of the current frame rate and thus your camera will no longer be affected by framerate.

If this is a change you'd like to see made, I'd be happy to make it.

Player's `heart_core_mat.tres` `emission_energy_multiplier` changes value every time the main scene is saved

Every time the main scene is saved, this value in the heart_core_mat.tres material changes:

diff --git a/Player/model/materials/heart_core_mat.tres b/Player/model/materials/heart_core_mat.tres
index ec92b25..7eb6d28 100644
--- a/Player/model/materials/heart_core_mat.tres
+++ b/Player/model/materials/heart_core_mat.tres
@@ -4,4 +4,4 @@
 albedo_color = Color(0, 0, 0, 1)
 emission_enabled = true
 emission = Color(0, 1, 0.392157, 1)
-emission_energy_multiplier = 0.669953
+emission_energy_multiplier = 1.2208
diff --git a/Player/model/materials/heart_core_mat.tres b/Player/model/materials/heart_core_mat.tres
index 7eb6d28..9d3e649 100644
--- a/Player/model/materials/heart_core_mat.tres
+++ b/Player/model/materials/heart_core_mat.tres
@@ -4,4 +4,4 @@
 albedo_color = Color(0, 0, 0, 1)
 emission_enabled = true
 emission = Color(0, 1, 0.392157, 1)
-emission_energy_multiplier = 1.2208
+emission_energy_multiplier = 2.16216

This messes up the git history but also actually changes the material. Might be a Godot bug, but I'm reporting it here first to debug.

Seen with Godot 4.0.4, and 4.1.1.

Extract photo mode to an addon

We have a photo mode right now to take screenshots and debug: CameraMode.gd. We should turn this into a third-party addon.

Notes:

  • It could use a camera node or rig instead of doing everything via code,
  • The rotation and controls feel laggy
  • Could use shift/alt as modifiers or mouse wheel + a visible slider to change movement speed at runtime

Various load errors due to missing files

Trying to edit the current main commit d2f35ef in Godot 4.0-rc (6cde3fac328e97e66b1c12d386deb25af395e215), I get the following load errors (on the second editor run, the first one is full of errors like Godot tends to be when the .godot folder isn't there yet):

ERROR: Can't open file from path 'res://models/shared/shaders/screen_shader.gdshader'.
   at: get_file_as_bytes (core/io/file_access.cpp:699)
WARNING: res://Enemies/beetle_bot/materials/beetlebot_eyes_mat.tres:4 - ext_resource, invalid UID: uid://bvxkh2pa1nqdq - using text path instead: res://models/shared/textures/eye_mask.png
     at: load (scene/resources/resource_format_text.cpp:448)
ERROR: Resource file not found: res://models/shared/textures/eye_mask.png.
   at: _load (core/io/resource_loader.cpp:226)
ERROR: res://Enemies/beetle_bot/materials/beetlebot_eyes_mat.tres:15 - Parse Error: [ext_resource] referenced non-loaded resource at: res://models/shared/textures/eye_mask.png
   at: _parse_ext_resource (scene/resources/resource_format_text.cpp:174)
ERROR: res://Enemies/beetle_bot/materials/beetlebot_eyes_mat.tres:15 - Parse Error: [ext_resource] referenced non-loaded resource at: res://models/shared/textures/eye_mask.png
   at: load (scene/resources/resource_format_text.cpp:735)
ERROR: Failed loading resource: res://Enemies/beetle_bot/materials/beetlebot_eyes_mat.tres. Make sure resources have been imported by opening the project in the editor at least once.
   at: _load (core/io/resource_loader.cpp:221)
ERROR: res://Enemies/smoke_puff/smoke_ball.tres:4 - Parse Error: 
   at: load (scene/resources/resource_format_text.cpp:510)
ERROR: Failed loading resource: res://Enemies/smoke_puff/smoke_ball.tres. Make sure resources have been imported by opening the project in the editor at least once.
   at: _load (core/io/resource_loader.cpp:221)
WARNING: res://Player/Coin/CoinVisuals/CoinModel.tscn:3 - ext_resource, invalid UID: uid://dqbsd44l6f1xi - using text path instead: res://Player/Coin/CoinVisuals/CoinModel.glb
     at: load (scene/resources/resource_format_text.cpp:448)
WARNING: res://JumpingPad/JumpingPadVisuals/JumpingPadModel.tscn:3 - ext_resource, invalid UID: uid://n4c3p8bt5sb1 - using text path instead: res://JumpingPad/JumpingPadVisuals/JumpingPadModel.glb
     at: load (scene/resources/resource_format_text.cpp:448)
WARNING: res://Box/Box.tscn:4 - ext_resource, invalid UID: uid://cdtq6fyl7hhgm - using text path instead: res://Box/BoxVisuals/BoxModel.glb
     at: load (scene/resources/resource_format_text.cpp:448)

There's indeed no models folder in the repo.

`res://Enemies/smoke_puff/smoke_ball.tres` sometimes fails parsing, and invalid UID warning spam

Every time I test this demo, I run into weird issues with res://Enemies/smoke_puff/smoke_ball.tres which gets corrupted. I've seen it happen on Linux, and now also on Windows 10.

Some issues might be attributed to upgrading to Godot 4.1.1 when this demo was last updated for Godot 4.0, so I'm doing my testing with Godot 4.0.4 for now to try to get to a relatively stable base before offering an upgrade to 4.1.

After cloning the repo and running it for the first time with 4.0.4, I had these warnings:

WARNING: res://Player/Coin/CoinVisuals/CoinModel.tscn:3 - ext_resource, invalid UID: uid://dqbsd44l6f1xi - using text path instead: res://Player/Coin/CoinVisuals/CoinModel.glb
     at: load (scene/resources/resource_format_text.cpp:448)
WARNING: res://Player/CharacterSkin.tscn:5 - ext_resource, invalid UID: uid://bbishx00t2kip - using text path instead: res://Player/model/materials/face_mat.tres
     at: load (scene/resources/resource_format_text.cpp:448)
WARNING: res://JumpingPad/JumpingPadVisuals/JumpingPadModel.tscn:3 - ext_resource, invalid UID: uid://n4c3p8bt5sb1 - using text path instead: res://JumpingPad/JumpingPadVisuals/JumpingPadModel.glb
     at: load (scene/resources/resource_format_text.cpp:448)
WARNING: res://Box/Box.tscn:4 - ext_resource, invalid UID: uid://cdtq6fyl7hhgm - using text path instead: res://Box/BoxVisuals/BoxModel.glb
     at: load (scene/resources/resource_format_text.cpp:448)
WARNING: res://Enemies/BeeBot.tscn:4 - ext_resource, invalid UID: uid://d28tem7s0fqin - using text path instead: res://Enemies/BeeBot/bee_root.tscn
     at: load (scene/resources/resource_format_text.cpp:448)

But the game ran fine.

After closing the editor, and editing the game again, I now get an error with the aforementioned smoke_ball.tres:

ERROR: res://Enemies/smoke_puff/smoke_ball.tres:4 - Parse Error: 
   at: load (scene/resources/resource_format_text.cpp:510)
ERROR: Failed loading resource: res://Enemies/smoke_puff/smoke_ball.tres. Make sure resources have been imported by opening the project in the editor at least once.
   at: _load (core/io/resource_loader.cpp:222)
WARNING: res://Player/Coin/CoinVisuals/CoinModel.tscn:3 - ext_resource, invalid UID: uid://dqbsd44l6f1xi - using text path instead: res://Player/Coin/CoinVisuals/CoinModel.glb
     at: load (scene/resources/resource_format_text.cpp:448)
WARNING: res://Player/CharacterSkin.tscn:5 - ext_resource, invalid UID: uid://bbishx00t2kip - using text path instead: res://Player/model/materials/face_mat.tres
     at: load (scene/resources/resource_format_text.cpp:448)
WARNING: res://JumpingPad/JumpingPadVisuals/JumpingPadModel.tscn:3 - ext_resource, invalid UID: uid://n4c3p8bt5sb1 - using text path instead: res://JumpingPad/JumpingPadVisuals/JumpingPadModel.glb
     at: load (scene/resources/resource_format_text.cpp:448)
WARNING: res://Box/Box.tscn:4 - ext_resource, invalid UID: uid://cdtq6fyl7hhgm - using text path instead: res://Box/BoxVisuals/BoxModel.glb
     at: load (scene/resources/resource_format_text.cpp:448)
WARNING: res://Enemies/BeeBot.tscn:4 - ext_resource, invalid UID: uid://d28tem7s0fqin - using text path instead: res://Enemies/BeeBot/bee_root.tscn
     at: load (scene/resources/resource_format_text.cpp:448)

Project fails to run in 4.0.2

I'm unsure of if there are further errors hidden behind the ones that are logged, but I don't know how to fix the existing ones myself to check.

Log:

Godot Engine v4.0.2.stable.official.7a0977ce2 - https://godotengine.org
Vulkan API 1.3.224 - Forward+ - Using Vulkan Device #0: NVIDIA - NVIDIA GeForce RTX 3060 Ti

USER WARNING: res://Player/Grenade.tscn:4 - ext_resource, invalid UID: uid://d5jny5gc8ntg - using text path instead: res://Player/GrenadeVisuals/grenade/grenade.tscn
at: load (scene/resources/resource_format_text.cpp:448)
--Main Shader--
1 | shader_type spatial;
2 |
3 | uniform vec3 shallow_color : source_color;
4 | uniform vec3 deep_color : source_color;
5 | uniform vec3 foam_color : source_color;
6 | uniform float water_scale = 1.0;
7 | uniform float time_scale = 100.0;
8 | uniform sampler2D noise_sampler : hint_normal;
9 | uniform sampler2D small_waves_sampler : hint_normal;
10 |
11 | uniform sampler2D foam_noise : hint_normal;
12 |
13 |
14 | float fresnel(vec3 normal, vec3 view, float intensity){
15 | return pow(1.0 - clamp(dot(normal, view), 0.0, 1.0), intensity);
16 | }
17 |
18 | void fragment() {
19 |
20 |
21 | vec2 scaled_uv = UV * water_scale;
22 | float scaled_time = TIME / time_scale;
23 |
24 |
E 25-> float _log_depth = textureLod(DEPTH_TEXTURE, SCREEN_UV, 0.0).x;
26 | vec3 _depth_ndc = vec3(SCREEN_UV * 2.0 - 1.0, _log_depth);
27 | vec4 _depth_view = INV_PROJECTION_MATRIX * vec4(_depth_ndc, 1.0);
28 | _depth_view.xyz /= _depth_view.w;
29 | float linear_depth = -_depth_view.z;
30 |
31 | float depth = VERTEX.z + linear_depth;
32 | depth *= 0.2;
33 | depth = clamp(depth, 0.0, 1.0);
34 |
35 | float foam_n = texture(foam_noise, scaled_uv + scaled_time).x;
36 |
37 | float foam_mask = smoothstep(0.0, 0.5 * foam_n, depth);
38 |
39 | vec3 screen_color = texture(SCREEN_TEXTURE, SCREEN_UV).rgb;
40 |
41 | vec3 screen_color_depth = mix(screen_color * shallow_color, deep_color, depth);
42 |
43 | vec3 water_color = mix(screen_color_depth, deep_color, fresnel(NORMAL, VIEW, 2.0));
44 |
45 | ALBEDO = mix(foam_color, water_color, foam_mask);
46 | ROUGHNESS = 0.02;
47 | SPECULAR = 1.0;
48 |
49 |
50 | vec3 normal_map = texture(noise_sampler, scaled_uv + scaled_time).rgb;
51 | vec3 small_waves = texture(small_waves_sampler, scaled_uv - scaled_time).rgb;
52 |
53 | NORMAL_MAP = mix(normal_map, small_waves, 0.5);
54 | NORMAL_MAP_DEPTH = 0.25;
55 | }
56 |
USER SHADER ERROR: DEPTH_TEXTURE has been removed in favor of using hint_depth_texture with a uniform.
To continue with minimal code changes add 'uniform sampler2D DEPTH_TEXTURE : hint_depth_texture, filter_linear_mipmap;' near the top of your shader.
at: (null) (:25)
USER ERROR: Shader compilation failed.
at: set_code (servers/rendering/renderer_rd/forward_clustered/scene_shader_forward_clustered.cpp:137)
USER ERROR: Condition "!version" is true. Returning: RID()
at: version_get_shader (./servers/rendering/renderer_rd/shader_rd.h:140)

Follow Camera Implementation Preferences

I would love to help contribute a toggleable follow camera option (like mario / uncharted) - when the player does not provide look direction input for X seconds, the camera autofollows the player direction. I have implemented this in a separate project, but would like to know if there is a preferred way you would like me to approach this for this project.

General approach in my other project:

  1. visible variable follow_camera, default to false on CameraController
  2. mouse_has_not_been_touched variable, set to false
  3. Timer on camera controller, set to 2 seconds, on timeout, sets mouse_has_not_been_touched to true
  4. when mouse input is detected sets mouse_has_not_been_touched to false and starts the timer

In player script, when follow camera is on and _camera_controler.mouse_has_not_been_touched and player is_moving, (not aiming), have the camera follow the player.

Screen Shot 2024-02-27 at 3 41 39 PM

Please let me know objections/considerations.

Misspelling in JumpingPad.gd Script

Although a simple mistake and not generally important, I thought I'd point out that the export variable in JumpingPad.gd is written as "impulse_strenght" instead of "impulse_strength".

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.