• 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.

Welcome to Unity Answers

The best place to ask and answer questions about development with Unity.

To help users navigate the site we have posted a site navigation guide.

If you are a new user to Unity Answers, check out our FAQ for more information.

Make sure to check out our Knowledge Base for commonly asked Unity questions.

If you are a moderator, see our Moderator Guidelines page.

We are making improvements to UA, see the list of changes.



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

Equivalent to Character Controller for Quadrupeds 3 Answers

Enemy AI character controller movement is super slow 0 Answers

How to make collision with moving CharacterController and moving Collider. 1 Answer

Character's trigger collides with itself 2 Answers

CharacterController had no enabled property 1 Answer

  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges