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 moneymaker · Mar 04, 2014 at 02:37 PM · gameobjectcolliderspriteunity 2dphysics material

Chewing gum Physics Material 2D

I am trying to create a GameObject that should work like a chewing gum. For that I did the following:

  1. Create an empty GameObject

  2. Drag the sprite (same width and height) into the previous GameObject

  3. Add a Box Collider 2D to the GameObject

  4. Create a Physics Material 2D

  5. Add the previous Physics Material 2D to the Box Collider 2D

I used a Bounciness value of 0.3f so it bounces a little and a Friction value of 0.8f so the objects that touch it get stuck but it is not working. I also tried with several combinations of those values but with no luck.

Is this the right approach? I am new to Unity so maybe I am not getting how really Physics Material work.

Please note that I am using 2D mode settings.

Comment
Add comment · Show 2
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 Dblfstr · Mar 04, 2014 at 03:53 PM 0
Share

All of these things you can do without using an empty gameObject. you can apply all these setting to the sprite. (unless you mean texture and not sprite).

What is actually not working? Is it not bouncing? Is it not sticking?

avatar image moneymaker · Mar 04, 2014 at 10:17 PM 0
Share

The bounciness value works as I expect but the Friction value does not. When I put 0 the ball in contact slides faster but I want the opposite. So I tried with 0.8, 1, 10, 100 but the ball in contact does not get stucked. I think I will try to create a joint dynamically to get the ball stuck. What you think about that? :7

1 Reply

· Add your reply
  • Sort: 
avatar image
1

Answer by moneymaker · Mar 08, 2014 at 03:30 PM

I ended up using another approach that works better. Using OnCollisionEnter2D I create a SpringJoint2D connecting the object that touched it. I also change the linear drag of the same object so it does not move too much.

  public class Gum : MonoBehaviour {
     
         void OnCollisionEnter2D(Collision2D collider)
         {
             GameObject go = collider.gameObject;
             SpringJoint2D joint = gameObject.AddComponent<SpringJoint2D>();
             joint.connectedBody = go.rigidbody2D;
             go.rigidbody2D.drag = 10;
         }
     
     }

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

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 click and drag a 2D game object without click and dragging the Camera Orthographic? 1 Answer

Getting a chest is not enabling my collider 0 Answers

If i flip the scale from a sprite, how do i make my game object child flip aswell? 0 Answers

SpritesSheet 2D - Changing Color using RBG setting? 1 Answer

sprite after animation 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