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 cr1t1cal · Jul 27, 2012 at 03:28 AM · collisionlayersignore

Layers of collision in Unity (or something similar)? (C#)

Hey, I'm in need of some way to ignore a large amount of objects at instantiation. Is there some way to set layers of collision in Unity such that an object can ignore a specific collision layer?

More specifically, my game requires a large amount of bullet objects. I am looking for some way for these bullets to collide with most of the objects in the scene but ignore the rest. Mostly I need the bullets to ignore other bullets in the scene. The only way I know of to do this is to use the IgnoreCollision() method, but there can be dozens or even hundreds of bullets in the scene at one time. I need a computationally quick way to ignore collisions with the rest of these bullets when a new bullet is instantiated.

I did some investigating and it seemed like this was a known requested feature some time ago, but I'm hoping there is some way to do this now. So, can anyone think of any way to do this other than somehow obtaining all of the bullets in the scene and iterating through all of them for each new bullet, ignoring collisions one at a time?

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

1 Reply

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

Answer by Bunny83 · Jul 27, 2012 at 03:31 AM

Just set your bullet-prefab to a seperate layer (a bullet layer). Then all you need to do is go to the physics manager (Edit->Project Settings->Physics) and setup the collision matrix as you wish.

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 cr1t1cal · Jul 27, 2012 at 03:39 AM 0
Share

That seems to be exactly what I was looking for! Thanks!

avatar image cr1t1cal · Jul 27, 2012 at 03:44 AM 0
Share

Also, if anyone else needs this information, How to set layers for prefabs: http://docs.unity3d.com/Documentation/Components/Layers.html

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

6 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

How to set up the CollisionIgnoreManager script to ignore a layer (C# question) 2 Answers

Physics.IgnoreLayerCollision - Help 2 Answers

Enable / Disable Layer Collision Matrix thru Script 1 Answer

Ignore collisions between a certain collider and a layer 2 Answers

How to create User layer that acts like the "Ignore Raycast" layer? 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