I am talking about the first person camera. It is not glued at the player's head position; it moves away a bit. It seems linked to the 3D model and not to the capsule collider that shrinks when we crouch.
SCore's "crouch thru 1 block" option still has the same problem I describe below, so it is not an option unless yours is working properly.
For example, in the file
resources.assets, the variable
PhysicsCrouchHeightModifier determines the crouch height. Anything below 0.50 will let you move through 1 block tunnels.
But the problem is that the camera will not follow that 0.50 or 0.40 crouch height. The camera will be positioned above and inside the block above the player. That is really bad because there is mesh backface culling so we can see through the back faces of blocks and even shoot through them. :(
If we could disable backface culling it could help already, so we would stop seeing behind walls, which breaks the game.
But the best thing would be to tweak the distance the camera is allowed to be placed away from the player head location.
To test what I mean, try to place an inverted ramp like this:
. \__ .@___
The player is the @.
When you crouch below the ramp, the camera may go as down enough to be able to look correctly through the 1 block tall tunnel. But as soon you move a bit forward, the camera jumps up again, above the 1 block tall tunnel and inside the block above it :(
So, it seems that there is a max distance the camera is allowed to stay away from the player head location, it seems to be between 0.12f and 0.25f. But what I need to know is: what is the name of the variable that could control that?
Alternatively, a patch for SCore 1 block crouch, could do the trick:
There is a commented code there. it is about getEyeHeight (so the camera would be properly repositioned). i guess it was a test that did not work right? Otherwise that code would not be commented.
I got a hint to create a 2nd camera to use only when crouched, on that file. I guess such camera would be independent and not affected by other parts of the code, therefore it would probably be easier to make it work as intended.