- Home /
Character controller falling down
Hi guys,
I have a character controller in my scene on a diagonal plane. My game moves the plane to the camera insted of moving the character forward, as it is an infinite runner game.
The fact is that if I move the scenary towards the player, the character controller (doesn't update collisions?) falls down instead of going up the ramp. It works correctly if I call CharacterController.Move, but as I said before, my game does not work this way.
Is there any method to make the character controller update without moving it?
Thanks!
Answer by LMan · Mar 14, 2014 at 01:16 PM
Might be crazy, but what if you put a constant force component on the character controller? And set the constant force to be just enough to counter the force that is making him fall down the ramp.
The force that is making him fall down is gravity. Not the physics one but a force applied by me to make the controller be grounded.
If I counter it, the character will be floating around and not even able to jump and fall down to the floor again, and it won't go up the ramp either.
As ar as I know, the controller needs to .$$anonymous$$ove to be updated. What I'm doing now is calling this
controller.Simple$$anonymous$$ove( Vector3.forward * 0.0000000001f );
The controller updates and the forward movement is practically 0, but it feels so much weird.
aha, so what you need is a cue for your gravity to stop pushing when the character is on the ground. Would the variable isgrounded on the controller work for that? Or does that not return true because of the slope? if not, Perhaps you could use OnCollisionEnter() to get collisions with the ground plane and do your own version of isgrounded.