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 Watmat · May 01, 2014 at 10:40 PM · 2dcollider 2dbouncingbordersrigidbody 2d

(2D) Creating a border around the game

Hey, thanks for reading. Here's my problem, I have a bunch of circles that are bouncing off each other [(which looks something like this)][1] but I'm having trouble making borders for those circles to stay inside. My current solution is to generate 4 rectangles situated just outside the visible area all with Rigidbody 2D and Box Collider 2D with a Physics 2D material set to the Material of the 2D Box Collider. This works great at keeping the circles inside the area, but right as the circles bounce off the border they lose a lot (almost all) of their speed.

Currently I have the rigidbody 2D of the borders set at a very high mass, linear drag, and angular drag in order to keep them in place (which to me seems like a work around solution).

Basically, how I do create a prefab the elastically bounces off other objects without moving itself?

Thanks in advance! [1]: http://upload.wikimedia.org/wikipedia/commons/6/6d/Translational_motion.gif

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

4 Replies

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

Answer by ivomarel · May 01, 2014 at 11:28 PM

http://forum.unity3d.com/threads/210775-Rigidbody-2d-constraints

http://forum.unity3d.com/threads/211844-2D-physics-bounciness-issue

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 Watmat · May 02, 2014 at 04:33 AM 0
Share

in the second link Berenger's comment fixed my problem! thanks for posting!

avatar image
0

Answer by Pyrian · May 02, 2014 at 02:50 AM

It sounds like you're working with the Rigidbody2D of the borders, but if they're static, they don't even need that component and probably shouldn't have it. Instead, to control the bounciness of the walls, you need to look at their Collider2D, and specifically the bounciness characteristic of their Material. 2DMaterials are very simple, having only bounciness and friction, but if you don't set one, I think they're both zero.

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
avatar image
0

Answer by Watmat · May 02, 2014 at 05:05 AM

Using Berenger's solution from http://forum.unity3d.com/threads/211844-2D-physics-bounciness-issue I was able to attach a script to 4 box2ds on the outside of my game acting as an outlined border

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
avatar image
0

Answer by drop_m · May 02, 2014 at 10:55 AM

your solution works, you've only to set the Friction of the physics2D materials to zero

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

23 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

Related Questions

How to conserve momentum when breaking apart a rotating 2D object? 0 Answers

2D Animation does not start 1 Answer

How to make total internal reflection effect in 2d? 0 Answers

How can I make 2d sprites for Unity ? 1 Answer

Moving static colliders in Unity 2D 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