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
1
Question by Theacesofspades · Feb 18, 2014 at 10:24 PM · 2dcolliders

2d collision detection

I am making a platform game and I can't for the life of me figure out how to make my player collide with the ground with unitys new 2d features. The player just falls right through the ground. My player and my ground both have rigid body's and my player has a character controller. The ground has a square collider. They are both sprites. Can anyone help me? Thanks

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 robertbu · Feb 18, 2014 at 10:35 PM 0
Share

You have a Rigidbody2D on both objects? Both objects have Collider2D colliders? While I haven't tested it, a CharacterController likely uses Physics.Raycast() rather than Physics2D.Raycast() so will not sense objects with 2D colliders. It is best to stick to either all 2D or all 3D.

avatar image Nodgez · Feb 18, 2014 at 11:02 PM 0
Share

Is one of them set to be $$anonymous$$inematic. $$anonymous$$inematic rigidbodies don't interact with the physics engine. also as robertbu said the character controller is for 3D which won't interact with any of the 2D physics.

avatar image JayOhhh · Feb 18, 2014 at 11:21 PM 0
Share

Seems stupid but make sure both your game objects Z coordinates are the same.

avatar image Theacesofspades · Feb 19, 2014 at 01:45 AM 0
Share

Ok Thanks. I'll try taking off the character controller and using rigid body movements ins$$anonymous$$d

avatar image robertbu · Feb 19, 2014 at 04:19 AM 0
Share

@$$anonymous$$Ohhh - 2D collisions use Vector2s. The 'z' coordinate of object is ignored, so the object don't have to have the same 'z' values.

Show more comments

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

21 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

Related Questions

How to detect multiple Colliders in the same object? 2 Answers

2D Coins and Points 1 Answer

Colliders 2d apparently touch each other even if they should not. 2 Answers

Moving an object with a collider in 2d? 1 Answer

Do I really have to do this? 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