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
5
Question by Skjalg · Jul 14, 2011 at 10:55 PM · charactercharactercontrollerstuck

Why does the character controller get stuck?

Hi.

I am currently writing code for our character controller for our upcoming game Pirates Of New Horizons

We stumbled upon this issue (pun intended, you'll get it), where the character controller gets stuck if he walks up a ramp and there is an edge there.

You can see the issue in a very simple scene we created with the standard character motor: Click here to see for yourself

All you need to do is press w and watch as the character controller slides along the wall of the upwards ramp for a tiny bit before he comes to a complete halt and is stuck there.

If you want to download the scene and check it for yourself within unity, then you can download press w get stuck

The funny thing is, this did not happen with Unity 2.6, but was inserted with the unity 3.0 release.

I have tried a lot of different solutions to fix this, but none of them have proved to overcome this issue, so I turn to you. Please help.

Comment
Add comment · Show 9
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 Chris D · Jul 14, 2011 at 11:13 PM 2
Share
  • for a very nice illustration of your problem.

avatar image Skjalg · Jul 14, 2011 at 11:17 PM 0
Share

hehe thanks, we think its hilarious :D

avatar image Chris D · Jul 14, 2011 at 11:26 PM 0
Share

To help narrow things down, what have you folks already tried?

avatar image UdevMike · Jul 14, 2011 at 11:34 PM 2
Share

I actually have this exact same issue. I changed the slope value on the character controller and it helped a bit but didnt fix it completely. Interested in an answer myself as well.

avatar image aldonaletto · Jul 15, 2011 at 12:46 AM 2
Share

It seems the Character Controller "sees" a wall and slide along it until the wall height gets too low - then it "thinks" it's a step, no more a wall, and wants to climb it ins$$anonymous$$d of slide along. But its Step Offset isn't high enough, so it gets stuck. To make matters worse, the wall/step limit seems to be based in the Step Offset: if you raise it, the limit raises too. But if when it gets stuck you change the Step Offset from 0.3 to 1, for instance, it climbs the step and goes ahead.

Show more comments

1 Reply

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

Answer by aldonaletto · Jul 17, 2011 at 01:52 AM

Well, I tried several tricks - probably many of them very similar to the ones you've tried. The only one which proved to work without collateral effects was the most stupid one: it just toggles the Step Offset between stepHeight and stepHeight+deltaStep at each frame, which fools the wall/step limit and allows the character to climb the edge at which it would otherwise get stuck (doesn't work if toggled only during collision). As a general rule, deltaStep must be somewhat greater than stepHeight for this to work.
This is a really dirty trick, for sure, but hope it can help you - and if you find any more elegant solution, please share it with us!

 var character: CharacterController;
 var stepHeight = 0.1;
 var deltaStep = 0.3;
 private var toggle = false;
 
 function Start(){
     character = GetComponent(CharacterController);
 }
 
 function Update(){
     character.stepOffset = stepHeight + (toggle? 0 :  deltaStep);
     toggle = !toggle;
 }
Comment
Add comment · Show 1 · 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 Skjalg · Jul 18, 2011 at 12:22 PM 0
Share

This is such a dirty hack, but it deserves the Accepted Answer anyways, since it works :P

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

9 People are following this question.

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

Related Questions

[Help!] Character stuck in ground, won't move 1 Answer

Character Controller sticky head.... Help!? 1 Answer

character controlling script 1 Answer

gravity or others. i don't get it. what i suppose to coding it 1 Answer

multiplayer offline Character selection. Help? 0 Answers


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