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 Befall · Mar 24, 2012 at 09:27 PM · terraincharactercontrollerjitter

Character Controlling grinding along any non-flat Terrain

Hey all,

Working on a 3rd person controller that is using Unity's built-in Character Controller.

As a test area, I simply made a small terrain, and made random bumps, plateaus, etc, in order to test out the controls.

However, on anything that isn't the default 0 height flat terrain, even completely flat plateaus, my character almost constantly slowly grinds along the ground, happening more so when I'm going left or right.

I'm using the built-in Character Controller functionality, so forward movement is as simple as

 controller.Move(transform.forward * speed * Time.deltaTime);

Anyone had this issue before? No problems falling through the world, but this grinding will prevent any use of this in game.

I should also mention the height is 1, radius is 0.5, slope limit is 45, step offset is 0.3, skin width is 0.08, and min move distance is 0.

Thanks for any help!

Comment
Add comment · Show 6
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 cowlinator · Mar 25, 2012 at 01:41 AM 0
Share

can you define "grinds along the ground"? Is this not the behavior you were expecting?

avatar image Befall · Mar 25, 2012 at 01:52 AM 0
Share

It shudders and jitters horribly, slowing down the movement significantly usually.

avatar image syclamoth · Mar 25, 2012 at 02:38 AM 0
Share

This, among other things, is why I never use the inbuilt 'CharacterController' component. They sound like a good idea, simplifying your control scripting, but in reality they tend to cause more trouble than they're worth. Either use a rigidbody, or write your own custom controller using raycasts and a collider.

avatar image Befall · Mar 25, 2012 at 02:54 AM 0
Share

I dunno, I'm having no problems besides this. Rigidbodies aren't fun to make controllers out of, and I'd rather not deal with having to handle collisions and such on my own. :\

avatar image Owen-Reynolds · Mar 25, 2012 at 02:52 PM 0
Share

Does it stop if you remove the check for grounded? (replace for now with if(true)?) What other checks are in your script?

The standard script only allows you to move when "grounded". Depending on terrain, I've had it move, then next frame have to "fall" 0.001 meters to be grounded again. $$anonymous$$ostly happens to me when walking a downward slope.

Show more comments

1 Reply

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

Answer by Owen-Reynolds · Mar 27, 2012 at 02:43 PM

One fix (have done it, but lost the code) for "not always grounded over uneven terrain" is to toss in an extra check: "if you were grounded 0.05 seconds ago, didn't just jump." Something like:

 float groundedUntil=0.0f; // will be a game time

 // movement code:
 if(Time.time<groundedUntil) { // replaces grounded check

   if( jumping ) {
     groundedUntil=0; // "turn off" the grace period -- we aren't grounded
     ...
   }
 }

 grounded = .....
 if(grounded) groundedUntil=Time.time+0.05f;
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 Befall · Mar 28, 2012 at 12:25 AM 0
Share

What I ended up doing was essentially a jump timer, but I also added in constant downward gravity to the walking phase as well. Otherwise, I ended up with this "fall every 0.X seconds when the jump phase activates" kinda thing. This is smooth and sexy.

Thanks for the help, again. :)

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

6 People are following this question.

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

Related Questions

Riding a second character controlled object 2 Answers

Randomly some prefab instances have Character controller misaligned 0 Answers

Motion over sloped terrain 0 Answers

Character controller / terrain collider - am I misunderstanding these? 1 Answer

Charactercontroller jittering while jumping into wall 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