0
Answered

Could someone explain character height to me (having trouble with doorways)?

marjohloo 5 months ago in Game Creator updated by Marti (Lead Developer) 4 months ago 5

I have a player who is set up with height 2 who cannot walk through the doorway below which has an opening 2 high. I can see the capsule probably sneaks over a hieght of 2 (I also moved the top of the door up by 0.25 and he can fit under albeit with a bit of hestiation).

However I have some prefabs with door opening at a height of 2 that I would really like the player to fit through. So I tried lowering the Height to 1.75 in the Character Controller but then though the player can fit through the doorway he ends up bow-legged. There is something I don't understand here, could someone explain?

Unity version:
2018.4.22f
Game Creator version:
1.1.6

Seems this is Unity rather than Game Creator (I'm learning both) from what I'm finding something to do with the step offset various suggestions are to make use of a box collider and adjust step offset to zero when there is the possibility to go through a doorway. If I find a solution will post an update.

OK so creating an action to set character height to 1.75 allows him to pass through the doorway and he doesn't slouch (unlike setting height in the character controller component) so I can just do this in an On Start trigger

Thank you for your research ^^; Me too I still have many things to learn about GC and Unity, and I had the same character height issue with my project.

Also regarding the Adventure Camera, when the doorway is too low, the camera tend to "jump", even if the character is just little enough to come through. For an unknown reason, delete and remake the camera fixed this.

As there is some interest in this setting player height at run-time from an action allowed passage through doorways without affecting the player's stance (setting the height in the character controller component in the editor did affect the height). If anyone needs to go further and fiddle with step offset the links below are what I found (but did not try):

https://forum.unity.com/threads/character-controller-step-offset-and-moving-through-gaps.202086/

https://forum.unity.com/threads/character-controller-getting-stuck-when-going-through-a-door-that-should-easily-be-fit-into-able.335783/

Answered

You have basically resolved the issue. However, bear in mind that, in the Character Controller you can modify the height, as well as the offset of the capsule. The character's feet should be at the bottom-line of the capsule. If the legs stick out of it, they will bent the knees due to the inverse kinematic algorithm applied to keep the feet aligned with the floor (though you can disable this).