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 PascalAus · Oct 28, 2013 at 01:29 PM · collisioncharactercontroller

IsGrounded working to slow?

Hey Guys,

I am trying to solve this CharacterController isGrounded problem. I have a 2d jump and run, like super mario. After implementing my CharacterController I found that sometimes my player cant jump. Basicly the isGrounded variable works very well. It only happens if my player was in the air/ notGrounded a short time before. For example my character runs down some stairs. The player clearly stops falling on every single stair, but the is grounded variable is never true. If I wait for a millisec the isGrounded becomes true. See the following picture.

alt text

If my character walks ( not running) down the exact same stairs the isGrounded variable becomes true on every stair. While bugfixing I tried several things: I used a raycast from the bottom of my player downwards. See the red line on the next screenshot.

alt text

The raycast behaves exactly the same like the isGrounded variable. It only „hits“ the stairs when the character walks slow enough.

I don't really understand, why the character stops falling on every stair and clearly collides with the stairs neither the raycast nor the isGrounded variable becomes true? I even tried to add another collider a little bit below the players feet. Same result :( Any ideas how to overcome this problem.

aeche.png (23.3 kB)
fuckkoff.jpg (18.4 kB)
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 Statement · Oct 28, 2013 at 01:49 PM 0
Share

Are you moving your character in Update or FixedUpdate? I would imagine if you moved you character during Update then the physics step would happen the next frame.

avatar image PascalAus · Oct 28, 2013 at 07:07 PM 0
Share

Thanks for the answer :) that is correct I am using the update $$anonymous$$ethod to move my character controller. But even then shouldn't the isGrounded variable be true the next frame?

avatar image Crystalline · Oct 28, 2013 at 08:08 PM 0
Share

There are quite a few more advantages using Fixed Update ins$$anonymous$$d of Update.. Try switching ,might actually help.

1 Reply

· Add your reply
  • Sort: 
avatar image
0

Answer by Benproductions1 · Oct 29, 2013 at 04:21 AM

Hello,

Most likely your problem is a missconception between the meaning of isGrounded:

IsGrounded (like your raycast) Is surprisingly not a state that gets evaluated over the time of the Move, but instead is only relative to the outcome of the Move.

Lets say your character is standing on the default 1x1x1 cube and call Move in a downward/forward direction. After the Move you will end up in the air somewhere off the cube. Obviously you had to collide with the cube for the Move however, when you check isGrounded you will see it is false, as expected.
The same happens when your character starts in the air above the cube. If you have a large vector for Move, then your character will again end up in a similar position, but on the way down/forward, it must have it the cube. If you check isGrounded again, it will also be false.

From this we canconclude, that at any point in time, isGrounded only checks whether you are currently on the ground, not whether you previously collided with something below you. This usually happens, because your framerate is not high enough for Move to be accurate enough that you end up on the ground at the same time your jump button is pressed.

As a workaround you have a choice of 2 things:
1. Use the FixedUpdate loop with a low interval in order to keep movement more accurate (will cause problems making your input work)
2. Write your own CharacterController and have it remember collisions from below and store them in the isGrounded state variable (hard work, but definately possible since I've done it before ;) )

Hope this helps,
Benproductions1

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 PascalAus · Oct 29, 2013 at 12:39 PM 0
Share

Hi,

thx for the answer. I tried the fixedUpdate $$anonymous$$ethod, but this didnt change anything. Still the same weird result. So I am going to write my own charController. Do you have any tutorials or you just developed everything by yourself. If you could post any advice or example code, would be awesome, cause I am still quite new to Unity.

Cheers Pascal

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

18 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

Related Questions

How does unity character controller work? 0 Answers

How to fix the position of a character when grabbing a rope? 1 Answer

Disable collision between mesh collider and character controller 3 Answers

How do I make a Character Controller NOT collide with Rigidbodies? 3 Answers

Building project (web or win) breaks charactercontroller 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