• 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 bwainscott · Feb 19, 2017 at 10:56 PM · rigidbody2dballblocksbreakoutridigbody

suggested rigidbody2d types to use? blocks and balls

I have a 2D breakout-like game with blocks and a series of balls. I want the balls to collide with and bounce off of the boundaries, the blocks, and any other fixed or moving obstacles in the playing area. BUT, I prefer that the balls do not collide with each other, I want them to pass through each other.

Using all Dynamic rigidbody2d for balls and blocks, with Static for boundaries works as expected but the balls collide with each other.

Can you suggest settings for the Body Type (and/or Simulated) field for the Rigidbody 2D components for the blocks, balls, and boundaries so that the balls do not collide with each other??

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

Answer by MelvMay · Feb 20, 2017 at 10:06 AM

The blocks should also be static unless you intend for them to move; this will also improve performance.

The balls should be dynamic if they are moving via forces or you directly setting the velocity of them. If you are controlling the position of them yourself by modifying the Transform.position and Transform.rotation them you should use a Kinematic body-type. If using Kinematic then you should also turn on the Rigidbody2D.useFullKinematicContacts which gives you full collision contact callbacks when Kinematic touches any body-type. Otherwise, Kinematic only contacts Dynamic.

If you don't want balls to collide with each other then place them on the samer layer and go into the 2D physics settings, specifically the layer collision matrix and uncheck the box which controls the ball layer colliding with itself.

Note: Ensure you use the 2D physics settings and not the 3D physics settings, both of which have their own layer collision matrix.

Layer Based Collision

Comment
Add comment · Show 1 · 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 bwainscott · Feb 20, 2017 at 06:16 PM 0
Share

Tried the layers suggestion and it worked!!
I didn't know anything about layers before, but found this layers collision picture (>1000 words), and it took me 1 $$anonymous$$ute to implement $$anonymous$$elv$$anonymous$$ay's suggestion!! $$anonymous$$any thanks, $$anonymous$$elv$$anonymous$$ay!!

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

The best place to ask and answer questions about development with Unity.

To help users navigate the site we have posted a site navigation guide.

If you are a new user to Unity Answers, check out our FAQ for more information.

Make sure to check out our Knowledge Base for commonly asked Unity questions.

If you are a moderator, see our Moderator Guidelines page.

We are making improvements to UA, see the list of changes.



Follow this Question

Answers Answers and Comments

5 People are following this question.

avatar image avatar image avatar image avatar image avatar image

Related Questions

Maintaining the trajectory of a ball when manipulating its velocity in a Breakout/Arkanoid clone 1 Answer

Paper Ball Physics Implementation 0 Answers

Setting the angle of a ball in a Breakout game 2 Answers

Bat and ball game - is there a way one can store the ball's last collision? 1 Answer

Help with respawning paddle and ball in Breakout 3D,Respawning a paddle and ball in Breakout game 0 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