- Home /
Avoid character to jump when using capsule collider
Hello everyone,
My game have a character with a capsule collider. When the character hit another collider on the spherical part of the capsule, the character is send in the air. How to avoid that?
Here is a video to explain the problem
I already have some solutions but it doesn't really work:
Use a cylinder collider instead of capsule, but it doesn't exist. I tried to make one with meshcollider and the result is not as good as a caspule collider since the meshcollider is not perfectly rounded. I also tried to make one with many rect collider but it produce same problems as meshcollider.
Set a really big gravity force when the character is on the ground, but the problem is that I have inclined plans in the game, so it doesn't work neither.
Thank you for your help
How do you move your character? Do you apply force or some other mean?
When moving rigidbodies you should avoid to control the velocity directly as this can mess up physic calculations. You need to use addforce / addrelativeforce ins$$anonymous$$d.
Thank you for your answer but the way I move is not the problem. The "wrong behaviour" showed in the video is the expected behaviour from unity. I am just looking for suggestion or idea to change this behaviour, and more precisely to overcome the fact that unity has no cylinder collider.
Is this a project you can share (complete with source code)? Would be easier to locate the error by having the project to investigate than just reading about the problem. Also you say expected by Unity, is this some tutorial you're following?