Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 12 Next capture
2021 2022 2023
1 capture
12 Jun 22 - 12 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
0
Question by xthunderduckx · Dec 18, 2019 at 04:38 PM · physics3d

Character controller getting stuck underneath of ramps

In my game, I have a character controller, which works fine for the most part, and is perfect aside from one quirk. The issue only seems to come in when the top of the character controller is touching the underside of a ramp, and at which point the player will not be able to move except in (roughly) the opposite direction of the wall's face.


To demonstrate the issue, I'll use some screenshots and captions.
alt text In this picture, the player is colliding with the ramp, and is unable to move unless they attempt to move away from the ramp. In most other games, which I intend to replicate, the player can still move to the left and right, but obviously not forwards further into the wall. In my case, the character controller seems to get closer to the ground and will not budge either left or right.


I did some testing, and found out that the player isn't actually applying ANY force to the slopes in this case, which seems to be an issue with the isGrounded() boolean of character controllers. Perhaps this is why going up ramps instead of underneath them does not produce the same errors. I can demonstrate this here: alt text As you can see in this picture, Before: (velocity), the velocity before the wall pushes back against the player, Force applied: vector3(), the normal * the amount of force applied, and after: (velocity). The odd thing is that the player is not applying any force to the ramp on the Z axis, which is why the player can accelerate against this wall?


Most importantly I found out that the velocity downwards into the ground is probably what is causing most of the issues, but I do not know WHY, nor how, or even what to do about it.


Edit: Due to the fact that the capsule collider has the sloped top, when they collide with a wall, the highest or lowest point of the capsule collider can not get any closer to the walls/floor/ceiling.
Unfortunately, this means that unless the player moves exactly parallel to or back away from the wall/ceiling / wall/floor combination, they will get stuck.
Now the question is then, how do you make the character controller interact with collidable objects as if they had a cylinder instead of capsule collider? I know you cannot change the collider type on character controllers, but is there any way to stop the player from moving into a space where a theoretical cylinder would end up at?

forceapplied.png (130.3 kB)
pic1.png (160.8 kB)
Comment
Add comment · Show 1
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image lgarczyn · Dec 19, 2019 at 06:37 PM 0
Share

There are a lot of weird things with this. First, a CharacterController or rigidbody cannot apply any force to a kinematic rigidbody nor to a static collider. How do you even get the vector you are displaying?

Second, do you use $$anonymous$$ove, Simple$$anonymous$$ove, or (that would be bad) Translate to Livraison the character?

Third, have you tried playing around with the various character controller settings? (Slope, etc)

A simple way to fix this would be to add invisible walls under ramps.

Another would be to add a raycast to prevent mouvements that would get the character stuck, but that might cause more problems.

1 Reply

· Add your reply
  • Sort: 
avatar image
0
Best Answer

Answer by JasonBennett · Dec 18, 2019 at 05:41 PM

My guess is that this has something to do with the Capsule Collider and its rounded edges. You are essentially getting the head wedged under the ramp so that the only safe direction is backwards.

Try adding a second Box Collider to your player GameObject and position it so that the player has a big blocky head. See if this fixes the problem, and if not, let me know.

Comment
Add comment · Show 7 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image xthunderduckx · Dec 18, 2019 at 05:42 PM 0
Share

I had thought of this, and I really just want the entire player to be a box collider, but that is only an option with rigidbodies. This is a character controller.

avatar image JasonBennett xthunderduckx · Jan 08, 2020 at 08:37 PM 0
Share

You can add a box collider to the Player gameobject. It won't interfere with the Capsule Collider on the Character Controller.

avatar image lgarczyn · Dec 19, 2019 at 06:31 PM 1
Share

I don't think you can add colliders to a CharacterController like you can for a rigidbody.

avatar image xthunderduckx lgarczyn · Dec 19, 2019 at 07:13 PM 0
Share

Can I simulate the theoretical cylindrical boundries of a collider any way? @ceandros

avatar image lgarczyn xthunderduckx · Dec 19, 2019 at 11:09 PM 0
Share

What do you mean by that?

Show more comments

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

221 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

Objects stuck dragging across floor 1 Answer

Player gets stuck into object after collision 2 Answers

Trying To Make Burger Builder 1 Answer

Car collision impact with object 1 Answer

Physics or Character Controller? 1 Answer


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges