- Home /
Character Controller "walking on air" off cliffs/slopes
I'm using the default character controller without editing much of anything (except the radius/height of the capsule as well as skin thickness). When I walk off anything but the slightest of downward slopes, I can basically "glide" through the air with my running animation playing. If I take off the character controller and just go back to using a normal capsule + rigidbody, this issue doesn't exist.
Any idea what would be causing this?
Thanks.
Edit: I just went and removed the colliders from my sword/shield that my player wields and it seems to have fixed this. Is there any other way to go about this without having to get rid of them?
Answer by MarkD · Oct 06, 2013 at 10:10 PM
I suspect that what is happening is indeed caused by the colliders, as you walk of the slope the character controller detects the colliders and walks up there. I had a similar thing and the only answer I have for you is that, as long as it is used as interface or part of the character it is best to not give it a collider. What you could do is let a collider exist outside of the character controller. There is no rule that a collider needs to be center on its object :), so you could just adjust the transform position of that collider to get outside the character controller.
Sorry for the wall of text and I hope I made myself clear enough :)
EDIT: I hope you are getting this edit update.
Hey sorry, it's me again. I was thinking today on your question once more and the solution suddenly hit me.
You have to make your sword and shield a rigidbody, then enable is kinematic. This way they will support all the collision data but will just move trough your character controller.
It will seem as if they don't collide, but they still send collision data wich you can call upon, for example: hitting enemy's and doing damage.
Sorry for the late re-post. But this should fix your problem and still let you use your character controller.
cheers
You are definitely right about the cause, however I'm not sure that solution works for my needs, unfortunately. $$anonymous$$y running animations (and others) will always cause the sword/shield (and their colliders) to collide with the capsule of the character controller.
Thanks for the input!
Well perhaps you should leave the collider disabled until needed? that way at least your shield can rest safely on your back. It shouldn't be to hard to detect if you are in the running animation, thus disabling the colliders.
Click the collider and watch it separate from the model in the scene view. Hilarious. Love that character controller...
@$$anonymous$$arkD - That's a good idea, except I wanted to keep the shield "live" even when it's not really in use. I think I'm going to just not use the controller... Too much of a hassle it seems like for pretty basic stuff. Thanks for all the help. I do appreciate it.
The controller can be a very powerfull thing, but indeed for some purposes, especialy with collider interaction from the character itself, it can be a pretty pain in the ass.
Another more anoing option, would be to create a layer and expell that layer from collision with your character controller, You would have to write a script that sees that layer as invisible and won't create collision, there should be some info on it on the unity ref.
I know I used that solution to make certain racyast hit or not hit objects infront and behind eachother. But it is an anoing hassle to setup.
Your answer
Follow this Question
Related Questions
Best practice when creating character / player control scripts? 2 Answers
How do I stop the 3rd person script from jumping up walls 0 Answers
Adding Multiple Slope Limits to the Character Controller 0 Answers
Player not responding to Jump Input 1 Answer
Character falls through upwards slope 0 Answers