Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 12 Next capture
2021 2022 2023
1 capture
12 Jun 22 - 12 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 Zidoark · Sep 11, 2019 at 08:17 PM · movementglitchstuck

CharacterControllerMovement stuck

Hello, trying to work my character controller out, I can walk an everything but when I go into a wall or a collider the controllers position still moves and sometimes makes the character glitch right through the wall, any idea why this is so?

 public class ThirdPersonPlayerMovement : MonoBehaviour
 {
     // Start is called before the first frame update
     private CharacterController charController;
     public float currentSpeed = 0;
 
     void Start()
     {
         charController = GetComponent<CharacterController>();
         
 
     }
     // Update is called once per frame
     void Update()
     {
         
 
     }
     void FixedUpdate()
     {
 #region Movement -------------------------------------------
         float hori = Input.GetAxis("Horizontal");
         float vert = Input.GetAxis("Vertical");
         Vector3 move = new Vector3(hori, 0, vert);
         move = this.transform.TransformDirection(move);
         charController.Move(move * currentSpeed * Time.deltaTime);
         
         #endregion
 
 
     }
 
    
 
 
 }
 

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 surfuay · Sep 11, 2019 at 09:23 PM 0
Share

i'm not sure if this is the case but normally when that glitch is happening its because only one of the objects has a collider and both need it OR there's a rigidbody missing on one of the objects (not necessary on both).

usually some type of combination of those 2 issues.

avatar image ZeBarba · Sep 12, 2019 at 01:00 AM 0
Share

The Character Controller is often used in the Update() method. But I don't find significant difference if it is inside the FixedUpdate()

On the other hand, your Inputs calls should be in the Update() for sure. Other wise you will miss some Input eventually. I would say that this is a possible cause for your problems.

Not related to you question, but I suffered a bit with it: You need to apply gravity to your character 100% of the time. Otherwise the isGrounded() method turns very unreliable.

avatar image Zidoark · Sep 14, 2019 at 08:50 AM 0
Share

thanks for your replys, sadly I still havnt figured out the problem even with your tips. its really odd.. I didnt have the trouble when I tried out the movement with transfrom.

avatar image ZeBarba Zidoark · Sep 14, 2019 at 11:43 AM 0
Share

Try using Time.fixedDeltaTime ins$$anonymous$$d of Time.DeltaTime.

Delta time gives you the period of the last frame, but your instructions are on the fixedUpdade, sou you should correct it using the period of the fixed update.

That is the only thing I can think of.

avatar image Zidoark ZeBarba · Sep 16, 2019 at 01:13 PM 0
Share

It didn't really do much either, thanks for taking the time to try help me, I see if I can find the problem with more google searches.

avatar image Skeasy · Sep 16, 2019 at 01:17 PM 0
Share

Hi, how did you set up your colliders? Do you have a appropriately sized collider? Did you check if some of them may be trigger? Did you change your characters collider to continous ins$$anonymous$$d of discrete?

0 Replies

· Add your reply
  • Sort: 

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

169 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 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 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 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 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 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 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 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 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 avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

Rigidbody2D character getting stuck when jumping on platform at climax point 0 Answers

Character Can't Move After Teleporting? 0 Answers

Moving a rotated plane in x+z directions with WASD? (bizarre behavior) 1 Answer

Forward movement question 1 Answer

Elevator script problem 1 Answer


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