Problem with uneven terrain

Hello together,

I have a problem with uneven terrain. My character can´t even move on small hills…
Here two picture to see on which low grad i already have problems (the red line in the first is the grade):
7458581--915518--upload_2021-8-29_21-30-16.png

I know that the problem is, that i set the “Skin Width” to 0,0001 in my character controller, but otherwise the character would be to high and it would be visible that it is flying/not on the ground.

I think it shouldn´t be a a problem actually to walk uphill, but i don´t know how to solve this. I already played a bit with RaycastHit, but not sure if that is the correct way or if that is even needed and tried some solutions that i found with google. It looks a bit for me, that there is in generall something wrong with my character/prefab/terrain.

I´m using the SimpleMove method from the characterController atm (but tested the Move method too).

Does any1 have a hint for me what i can check or in which direction i should go to find a solution ?

Kind regards,
Sphinks

Steps to success:

  • read the CharacterController doc and note how they suggest setting a larger skin width

  • note how they say that not doing so causes problems

  • note how you are having problems

  • go back and make your skin width appropriate to the ratio suggested in the docs

  • reduce the overall vertical size of your capsule so your character is no longer floating above the ground.

1 Like

@Kurt-Dekker thanks for the hints and shame on me for not checking the docu correctly :sweat_smile:.

I put the values like in the docu descriped, but the problem still exists…
Is it definitive a problem of wrong settings from the CharacterController/CapsuleCollider or could it also be caused on other factors ? Because the grade is not high and i guess that should work per default ?!

Ok, i´m just dumb. Changed the values on the original prefab, but the one i use in the scene was not updated, so it had still the old wrong values…

Changed the values in the prefab i have in the scene to what the docu recommended and it works.

Thanks @Kurt-Dekker !

1 Like

Aaah yeah, the cascade of updates… it’s a real thing!

Level 1:

public int value = 123;  // set in code

Level 2:

  • Saved in mydude.prefab

Level 3:

  • Overridden in myscene.unity

That’s not even including these newfangled “prefab variant overrides!”

1 Like

Yeah, i set the values directly in the editor but as soon as any change was done in the “scene object” instead of the original prefab it doesn´t update anymore the “scene object” if the original prefab is changed, you have really to be careful about that and keep that always in mind… or as you showed, just change the values in code :smile:

Actually no, that’s the ULTIMATE red herring!

The instant you make a prefab OR save a scene with that script, the code value gets ignored forever onwards, even if you never change it in the prefab or scene.

Here’s more:

Field initializers versus using Reset() function and Unity serialization:

https://discussions.unity.com/t/829681/2

https://discussions.unity.com/t/846251/8

Bottom line, when in doubt stick a Debug.Log() statement in the code and PROVE what the data is.

Thanks a lot for the links and info !