Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 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 limo43 · May 23, 2013 at 09:40 AM · collidercharactercontrollerslowstairsramp

Character Controller slowing down after climbing a slope

I have a scene where my Character Controller must move between boxes of varying heights, seperated by small staircases. In order to do this, I have used a tilted box collider for the staircase collider, which the character is able to walk up like a ramp. As I have set the Character Controller slope speed multiplier to a consistent value of 1.0, the character is able to walk up staircases of varying gradients at a consistent velocity.

However, when the character reaches the top of a staircase and begins to walk again on a horizontal plane, their movement speed drops dramatically, seemingly inversely proportionally to the steepness of the staircase collider. Their speed snaps back to normal after moving a seemingly random distance. I am using Unity 4.1.2, and after altering a number of Character Controller variables and experimenting with different kinds of colliders I still can't seem to resolve this issue.

Comment
Add comment · Show 3
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 Edy · Sep 27, 2014 at 11:25 AM 0
Share

I'm encountering this issue as well. Anyone?

avatar image robertbu · Sep 27, 2014 at 03:49 PM 0
Share

@Edy - likely have to see the code. You should do a Debug.Log() of the movement vector just before you pass it to the CharacterController to see what is going on. You should also take a look at the collision flags to see if there is a collision issue.

avatar image Edy · Sep 28, 2014 at 11:01 AM 0
Share

I think I've found the case (and the fix), posted as answer.

1 Reply

· Add your reply
  • Sort: 
avatar image
0

Answer by Edy · Sep 28, 2014 at 11:01 AM

Most likely the character is encountering a steep normal at the top of the slope. When this happens, the velocity dramatically decreases. The fix is modifying the CharacterMotor.js script, specifically the function AdjustGroundVelocityToNormal here (line 364 in my version):

 desiredVelocity = AdjustGroundVelocityToNormal(desiredVelocity, groundNormal);

In my case I've voided that function completely, so the velocity is preserved no matter the slope of the ground:

 desiredVelocity = desiredVelocity; // AdjustGroundVelocityToNormal(desiredVelocity, groundNormal);

You might prefer to tweak the AdjustGroundVelocityToNormal function not to have so much influence in your character's velocity.

EDIT: You can safely void the CharacterMotor.AdjustGroundVelocityToNormal function and tweak the velocity with the slope using the curve CharacterMotor.slopeSpeedMultiplier. It's a much more convenient way to fine tune the velocity of the character with the slope of the ground.

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 tiltaghe · Oct 08, 2014 at 07:51 PM 0
Share

Holy sun, Thank you so much for this!!

PS: I would upvote but I dont have enough reputation to do so :(

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

15 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

Related Questions

add camera collision without CharacterController 1 Answer

C# Slow Down all Gameobjects Within another Gameobject's Collider 2 Answers

How to prevent the character controller sometimes passing through walls? 2 Answers

My Character controller is being push a little bit when i'm about the get the coins. How can i possibly detect collision and destroy the coins without actually getting affected by the colliding physics? 1 Answer

Rigidbody bounce or character controller istrigger issues 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