• 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
Question by atmosgames · Oct 21, 2016 at 11:25 PM · 2d-platformer2d-physics

Character Controller Falls Through Box Collider Ground 1% Of The Time!

Background: Hey there! I'm working on a 2D platformer that utilizes 3D Box Colliders as terrain. Each scene has 5 or so intersecting box colliders that act as terrain. This was the easiest way for me to build out my scene, and actually gives me a high level of control.

alt text Problem: I'm currently doing beta testing with a testing company, and they have mentioned that, very, very rarely, sometimes the character controller will fall through a walkway (box collider). I've had this happen on occasion as well, more so inside the editor than in a standalone build.

Any ideas as to why this is happening? I assure you, it's not what you think:

  • It's not suddenly becoming a trigger

  • It's not disabling

  • It's not destroying

  • Once the pass through occurs, the player will always pass through (if I grab the player and move him up and drop him. Even if I switch the collider on and off, enable and disable the trigger, etc.

This happens sometimes to my player, but also sometimes to enemies that also use the Character Controller component. It's seemingly randomly.

It really is just not working. I think it might be a Unity glitch. I've had this happen only in Unity 5.

What I can say is the box colliders are not ticked as "Static". Additionally, the colliders are all separate game objects, not multiple components on one game object.

Thanks! Thomas

walkway-1.jpg (150.4 kB)
Comment
Zyriab

People who like this

1 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 SomeGuy22 · Oct 22, 2016 at 02:44 AM 1
Share

Is your character Motor logic in FixedUpdate? If so, you might get more precise logic if you move it to Update.

avatar image atmosgames SomeGuy22 · Oct 22, 2016 at 05:01 PM 0
Share

Yes, it is a fixed update. Do you think that could result in passing through the collider and permanently getting confused?

avatar image atmosgames SomeGuy22 · Oct 28, 2016 at 12:53 PM 0
Share

So I tried using Fixed Update, and felt it was working great, but suddenly my character passed through the Box Collider again. For clarity, once my character controller passes through the box collider, if I go back to the collider and try and jump on it again, the controller passes through again. It is permanently passing through. Any ideas?

1 Reply

· Add your reply
  • Sort: 
avatar image

Answer by Benjames · Oct 22, 2016 at 01:38 AM

I once had to do a check with raycast from the rigidbodys last position to its current position to keep bullets from occasionally going through walls. Maybe not the most efficient way but it worked.

Comment
Landerk
Zyriab

People who like this

2 Show 2 · 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 atmosgames · Oct 22, 2016 at 02:17 AM 0
Share

Sorry, could you explain this a bit more? In my case, I'm not using Rigidbodies. I'm simply using box colliders as ground and a Character Controller.

avatar image Benjames atmosgames · Oct 22, 2016 at 04:11 AM 1
Share

So on void FixedUpdate try doing a spherecast or capsule cast between the character controller's last position and current position. It is a redundant check and might be computationaly expensive but it should keep the character from falling through. I used this on a phone game and it didn't hurt framerate. Let me know if you need an example.

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

If you’re new to Unity Answers, please check our User Guide to help you navigate through our website and refer to our FAQ for more information.

Before posting, make sure to check out our Knowledge Base for commonly asked Unity questions.

Check our Moderator Guidelines if you’re a new moderator and want to work together in an effort to improve Unity Answers and support our users.

Follow this Question

Answers Answers and Comments

61 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

Related Questions

Velocity Issues: First Character Controller Unity 2D 1 Answer

Velocity in Unity2D 2 Answers

HOLD JUMP BUTTON TO JUMP HIGHER 2 Answers

RotateAround using physics 1 Answer

2D Collisions Not Working 2 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