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

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

6 People are following this question.

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

Related Questions

Animating character around terrain on preprogrammed route without players control 0 Answers

[Character controller] run faster on slopes and jetpack 1 Answer

walking throu terrain 3 Answers

Extracting RGB component data from a textured plane positioned below a 3D terrain 3 Answers

Close To Camera Objects 0 Answers

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