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
2
Question by JustinTheSwift · Nov 16, 2017 at 02:05 AM · collidercharactercontrollercolliderscollider2dcharacter controller

Character Controller won't collide with anything

I'm in 2D. I have a character controller on my playable character. He's moving great, however the character controller will not collide with anything under any circumstances (I'm using boxcollider2d on environment objects). It seems like the character controller, which purportedly comes with a collider built-in, shouldn't move straight through walls - or am I REALLY missing something about how this thing is supposed to work?

The docs say the character controller doesn't need a rigidbody (that's the point of having a CC isn't it?) and doesn't need a collider added to it. In fact, Unity won't let me add a collider or rigidbody to a gameObject with a character controller.

Things I've tried:

1. Toggling off "Is Trigger" on my collider object (and no, there is no such setting on character controller)
2. Adding a rigidbody2D to a child
3. Adding a boxcollider2D to a child
4. Using OnControllerColliderHit to write my own "don't walk through stuff" code (it never fires)
5. Adding rigidbody2D to everything in the environment (they all just fell off the screen - and they went straight through my player on the way without touching him, so turning gravity off is irrelevant).
6. Tearing my hair out.

Comment
Add comment
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

1 Reply

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

Answer by Bunny83 · Nov 16, 2017 at 02:27 AM

The CharacterController is a 3D object. From the (3D) physics point of view the CharacterController is an upright CapsuleCollider. Of course it doesn't work with 2d colliders. The 2d and 3d physics systems have no relation to each other. for 2d physics Unity uses "Box2d", for 3d physics it uses "PhysX". If you want to use the CharacterController you have to use 3d colliders (SphereCollider, CapsuleCollider, BoxCollider, MeshCollider).


If you want to use 2d physics and 2d colliders you have to use a Rigidbody2D instead. There is no equivalent of a CharacterController for 2d.

Comment
Add comment · 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 JustinTheSwift · Nov 16, 2017 at 12:28 PM 0
Share

Works like a charm. I suppose I really was missing something fundamental. Now if only there were a charactercontroller2D to make life a little simpler.

avatar image perolehs · Jan 01, 2019 at 04:00 AM 0
Share

Omg I love you. I stuck in this problem for hours T_T... THX!!!!

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

99 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

Related Questions

Collider keypad 0 Answers

Character Controller giving false collisions 0 Answers

detect if collider is not touching anything 0 Answers

Polygon Collider 2D doesn't have the "edit collider" button avaliable. 0 Answers

How to destroy player when collide with enemy? 3 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