ColormaticStudios / quality-godot-first-person

Actually good first person controller for Godot 4.2
https://godotengine.org/asset-library/asset/2087
MIT License
10 stars 4 forks source link

Crouch bugs #6

Open Slluxx opened 11 months ago

Slluxx commented 11 months ago

Multiple Things i noticed

Crouching transforms the body and collision from the center, which sometimes (more often than not) causes the player to float due to its shrunken size and then drop to the ground. I dont know if its possible to change the transform origin to the bottom of the player or if a different solution has to be found.

It also causes the camera to glitch into the body but i think thats because the distance the body shrinks and the camera moves is different.

Being crouched and releasing the key while being under something with a collision should stop the transform process back to normal until enough space is available. This can be done using 1 (or more if more presicion is needed) RayCast3D Node(s). Currently, the code doesnt check this and it will either stop the player from moving at all or cause other bugs. Screenshot 2023-12-07 143536

ColormaticStudios commented 11 months ago

https://github.com/ColormaticStudios/quality-godot-first-person/commit/daaf5107d0bcd7458b4169012c12902b8eb460b2

Slluxx commented 11 months ago

Nice, but what about the transform-origin/camera position bugs?

ColormaticStudios commented 11 months ago

Right. I couldn't find any camera bugs in my testing, but the transform origin definitely is a problem. I don't exactly know how to fix that.

Slluxx commented 11 months ago

Sadly i dont know a solution to that either. All i can come up with are hacks that will have undesired effects. The cleanest hack i can come up with on the spot would be to save the height of the player and apply it while the size is changing. When jumping it doesnt really matter i guess cause it will make you just jump "slightly higher", but when on the ground, it would glue you to it.

The camera bug i only noticed when changing

var base_player_y_scale: float = 0.95
var crouch_player_y_scale: float = 0.45

To make the player fit under 1 standing and .5 crouched.

https://github.com/ColormaticStudios/quality-godot-first-person/assets/15162905/b7a55a2d-c620-4132-ab5b-202cbaa315ee