• 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
2
Question by attlue · May 03, 2011 at 12:42 PM · collisionrigidbodyrigidbodies

One-Way Collision Between RigidBodies

Example:-

RigidBody_A IS NOT KINETIC

RigidBody_B IS NOT KINETIC

RigidBody_A CAN detect collision with RigidBody_B

RigidBody_B CANNOT detect collision with RigidBody_A

Is this collision possible to setup?

Any help will be greatful thanks!

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

Answer by Bunny83 · May 03, 2011 at 01:12 PM

Well what you're asking can't be generalized in any way. Actually do you mean physics collision response or do you mean the collision messages? The physics can't be setup that way. If there's a collision it has to be between TWO objects.

To prevent the collision message on one of those two objects i would give object B a referenc to object A, so it can determine when it collides with A.

//JS

var doNotCollideWithThat : GameObject;

function OnCollisionEnter(col : Collision) { if (col.collider.gameObject != doNotCollideWithThat) { // Hey, it's not Object A } }

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 Joshua · May 03, 2011 at 01:27 PM

You could have triggerspheres around both of them, and if they are in eachother's triggersphere turn them to kinematic. Then fake the physics.

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 Scopperloit · Feb 16, 2013 at 04:28 AM

This depends on what you want to do. You'll have to give some more conditions, because like Bunny83 pointed out, two objects will always collide with eachother, never one object with another.

However, if one of the objects is at rest or have low velocity and the other collides into it with rather high velocity, that is something you could define as one-way collision. Now you can take the objects' velocities into consideration.

You could for example script this scenario:

 if RigidBody_A has greater velocity than RigidBody_B then collision is true
 else, collision is false.
Comment
Add comment · Show 2 · 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 Noxury · Jul 23, 2020 at 08:58 PM

If you actually want to affect only one body from impact force (on both NON-Kinematic Rigidbodies), try setting the mass of the uneffected body to 0. This will prevent beeing able to push for object, but stop it.

An example would be physical camera movement. The camera should react to collisions, prevent clipping through objects, but is not allowed to push the player. Instead the player can push the camera away.

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.

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

3 People are following this question.

avatar image avatar image avatar image

Related Questions

Collisions While Rotating Objects Without Character Controllers 1 Answer

Collisions: do they need two rigidbodies? 2 Answers

what object hit me? easy rigidbody question 1 Answer

Avoid Rigidbody Intersection 1 Answer

Kinematic rigidbodies 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