- Home /
CharacterController running downhills
Hi,
I have a moving CharacterController and I'm trying to make it so that when ground "disappears" from beneath it's feet because of a down slope then don't fly off but rather stay on the ground. I don't want to rotate it just align it's Y with the Y of this slope's surface.
I'm using raycasting to determine if there's ground beneath it till a certain height and it works fine. I try to align by simply altering my "deltaMovement" which gets passed into Move at the end of update.
The problem is that it walks down with a limited speed. Why is this limited? I don't know :/. Looked through the whole code twice I swear. Tried adding a PhysicMaterial with zero values to make take out friction from any possible calcualtion but it seems like that it's useless as there aren't any rigidbodies here, though I'm not quite sure if that's needed or not.
The problem seems to be that no matter what controller.isGrounded doesn't consistently stay true. But that's why I try to align by altering deltaMovement rather then direct translation and has no effect.
As you can see I'm quite confused. Also kinda sad as it seemed pretty easy and I was very happy when all plans and calculations on paper were correct.
Thank you for reading :)
Can't you just increase the gravity to make the character stick to the slope better?
actually that does solve the problem so I though that simply substracting more from "delta$$anonymous$$ovement.y" would solve it too but it doesn't so there might be a bug in my code(will update(topic too))
Answer by matyicsapo · Apr 15, 2010 at 07:50 PM
spinaljack's comment helped a lot
figured out that the problem was with my code
i could find the right value to align teh charactercontroller to the ground i just had to apply it outside stuff
sg. like this' http://www.unifycommunity.com/wiki/index.php?title=FPSWalkerEnhanced anti-bump stuff
anyway thanks for reading :D