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 Strospiteri · Nov 16, 2013 at 06:57 PM · 2dcollisionphysicsrigidbodycharactercontroller

Unity 4.3 CharacterController collision with physics 2D not working

Hi, I've been experimenting with the new Unity 4.3 update and have run into a problem regarding collisions.

I have set an object with a CharacterController component and a sprite object with a physics 2D polygon collider.

For some reason the controller doesnt collide with the sprite object when they come into contact and it passes through. I've tried the same with a rigidbody as in the tutorial and that works, however programming character controls with a rigidbody is more cumbersome.

I want to confirm if this has anything to do with the CharacterController component not working with Physics 2D. Thanks.

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
1
Best Answer

Answer by gamenovice · Nov 17, 2013 at 02:45 AM

After an initial look, it doesn't look like there is a charactercontroller in 2D for the new unity API. It's become apparent that they have split up their major tasks between 3d and 2d specifically, such as Collider2D, Physics2D, etc. Chances are you may be out of luck in getting CharacterController to work with physics 2D, but don't quote me on that. If you feel something is up do a little more research.

about programming controls for a rigidbody, you'd be surprised, it's actually very decent and manageable working with rigidbody2D, and it's probably the reason they didn't implement characterController2D (either that or they have not gotten to it yet).

what you can do is the following, give the object a collider and rigidbody, and if it has animations, an animator component. This way you are at least guaranteed interactivity.

for moving an object via rigidbody, the following code should suffice, provided you have set the drag parameter to a value so that it will stop over time:

 if(Input.GetButtonDown("Fire1")) //just an example of input
 rigidbody2D.AddForce(-Vector2.up * moveSpeed*Time.deltaTime);
  //vector2.up and vector2.right are the only ones in the class, but you can negate them to get the other directions

of course moving by position is one of the main things to do with rigidbodies, besides rotating or scaling. Again you'd probably still need to do your research for a better answer. For now this is the best I got.

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

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

18 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

Related Questions

Character controller partially passing through rigidbody in a head on collision 2 Answers

rigidbody2D.addforce in collider 1 Answer

Is there a rigidbody character controller 3rd person that can handel stairs (steps)? 1 Answer

Can't use Rigidbody or Character Controller 0 Answers

where to trigger which collision event? 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