• 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 iamsteele · Jun 05, 2014 at 03:14 AM · rigidbody physics

How to make rigidbody only interact with terrain

effectively, I want to spawn items and have them only interact with static objects, not other items that may be on the ground... because if you drop a bunch of items on top of eachother they'll push eachother around and bounce up and down in strange ways... and i'd rather they only pay attention to static objects like the terrain and buildings and etc, ignoring players and other inventory items thrown on the ground.

or... better yet have them interact with eachother and the terrain, but not bounce off eachother? (no transference of force on collision, only paying attention to gravity)

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

2 Replies

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

Answer by rutter · Jun 05, 2014 at 03:17 AM

Sounds like you should read the layer-based collision manual page.

You could create two layers:

  • One layer which you apply to all ground colliders; let's call it "Ground"

  • One layer which you apply to all of the rigidbodies you're looking at; let's call it "Rigid"

Go into your physics settings, and rig it so that the Rigid layer does not collide with any layer other than Ground.

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
1

Answer by Tekksin · Jun 05, 2014 at 04:04 AM

What rutter said. The layer of the gameObject can be changed in the inspector. Assign it there, first, if it isn't on a layer. There's "layer" next to the tag drop down. You can make new layers, or see which are available by clicking the drop down. Once accessing the "add layer" area, you can see which numbers are assigned to what layers.

you can effect these through script (ask if you want to know) but you can just as easily go to edit > project settings > physics (for 3d or physics 2D for 2D). Then just uncheck the things you don't want to collide with. Also, make sure the physics material these objects have isn't a bouncy one. This is something which can also be changed through scripting by saying something like:

 function OnCollisionEnter(coll : Collision){
    if(coll.gameObject.tag == "the thing you don't want it to bounce off of"){
          transform.collider.sharedMaterial = somethingElse;
     } else{
          transform.collider.sharedMaterial = originalMaterial;
     }
 }

You may need to turn the collider on and off to apply these physics material changes. Thats done by just saying transform.collider.enabled = false; and then the same line, but set it back to true; so that its turned back on. Sorry if this is not what you wanted, but you did make it sound like you wanted things to bounce off of some things and not others.

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 iamsteele · Jun 05, 2014 at 06:34 AM 1
Share

thank you for the excellent reply! I actually ended up at the same conclusion as the response I marked as answer on my own, checked back here, and found more information posted by yourself, thank you both!

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

If you’re new to Unity Answers, please check our User Guide to help you navigate through our website and refer to our FAQ for more information.

Before posting, make sure to check out our Knowledge Base for commonly asked Unity questions.

Check our Moderator Guidelines if you’re a new moderator and want to work together in an effort to improve Unity Answers and support our users.

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

Making RigidBody face direction for movement 1 Answer

How to flick an object away with a swipe 0 Answers

Plane CollisionWheels keep jumping around 0 Answers

Rigidbody movement with turns for a one wheeled motor cycle. 0 Answers

How can you make a pendulum GameObject to never stop swinging? 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