• 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 ozamirly · May 10, 2014 at 09:30 AM · collisiondetection

Allow players to walk through one another but maintain normal physics with the rest of the world

Hello world,

In my game, I have numerous player objects with collider2ds and rigidbody2ds attached. I would like to allow the players to walk through one another while maintaining normal physics behaviour with the rest of the world. However, I would also like to be able to receive calls to OnCollisionEnter2D and OnTriggerEnter2D, so in essence, I want to be in complete control of the collisions between two objects on the same layer while maintaining normal behaviour with the rest of the word.

I have tried various solutions involving the global physics collision matrix but in every attempt, I was unable to receive calls to the respective collision callbacks. Anyone have any bright ideas?

Comment
Add comment · Show 1
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 D3ltaVyyb · May 10, 2014 at 01:24 PM 0
Share

Hmm.. Until Unity updates with the Physics2D.IgnoreCollision , for now you can add an extra trigger (soft) collider, slightly wider than your non-trigger (hard) collider. And when Player2 enters Player1's soft collider, disable the Player2's hard one until it exits Player1's soft one. It might cause a few problems depending on your game but that's a temporary solution.

0 Replies

· Add your reply
  • Sort: 

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

22 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

Related Questions

Hand-Held Weapon Collision Detection Not Working (going through walls) 1 Answer

How do I make OnTriggerEnter() respond to just one collider? 2 Answers

Test if BoxCollider is within another BoxCollider? 4 Answers

How can I destroy my Player when it touches another object? 1 Answer

How to set circle collision detectors more accurate 1 Answer

  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges