Correctly smooth crouch script?

In all internet, there isn’t any crouch script that work correctly without mistakes like this:
-On crouch/uncrouch the player fall down of the map.
-When uncrouch, player go through the ceiling.
-Smooth crouch/uncrouch.

It’s too hard do this? For me, yes; because I’m a beginner programmer. But for a advanced programmer this must be a easy task (maybe).

A tutorial teaching it would be famous. Why anybody do this?

I only found two styles of videos:
-The tutorial with full errors.
-The video that show to you his work (a perfect and great work) but without showing his script or how it has done.

I take the opportunity to ask the following: Somebody know any tutorial series that teach you advanced programming in c#? To do scripts like this.

Thanks.

Look for BurgZergArcade on youtube. He has a huge tutorial series on unity and c#.

But to your actual problem:

I can’t think about the falling through the worid without looking at the script but you can prevent the clipping through the ceiling by doing a raycast upwards every time the player tries to stand up. If the raycast hits the ceiling that means there’s not enough room for him to stand up and you simply don’t execute the stand up step.

Hi I know this is an old post but incase someone new comes along like I did I have posted a video with a project download link to a heavily extended first person controller

@Zodiarc Wow thanks!! It work perfect! :smiley:

Worked Perfectly Thanks