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 Sam 5 · Mar 19, 2011 at 02:26 PM · collidersignorecollisioncompound

Compound Colliders and IgnoreCollisions

Ok, so game is about spaceships with guns. Nothing all that unique there. I instantiate bullets at the gun and I want them to ignore collisions with the ship firing them.

Ignoring collisions with transform.root helps but doesn't solve all the problems because all of my ships use compound colliders. Bullets are still colliding with the child colliders.

I want to ignore collisions with root and all of root's children. I don't want to name the colliders manually because some ships have more colliders than others. Advice?

One idea I've considdered but it is very clunky: each ship has a variable for how many colliders it has. We'll call it collNum create some list using a for loop in range collNum. Name all of my colliders "Colliderx" do some string manipulation where that list of numbers is now a list of 'Collider' + number do a find function on everything in that list. Ignore collisions with everything found. Is that really the best way to do it? I'd also need to make sure, then that I'm not ignoring collisions with other ships compound colliders.

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

Answer by efge · Mar 19, 2011 at 02:33 PM

You could use Layer-Based Collision Detection.

Comment
Add comment · Show 3 · 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 Sam 5 · Mar 19, 2011 at 10:31 PM 0
Share

Wouldn't that mean I'd have to make every single ship it's own layer?

avatar image Sam 5 · Mar 19, 2011 at 10:36 PM 0
Share

Thinking about it some more, It seems like for layer based collision detection to work in this case I'd need to form a new layer when I spawned a ship and then use code to ignore collisions with that layer. I'd not be able to use the inspector because the layer wouldn't exist until the ship spawned at runtime. Would this really be easier or less resource intensive than the string shennanigans described above?

avatar image synapsemassage · Aug 08, 2011 at 09:55 AM 0
Share

Depends on how you treat friendly fire in general. If you have to opponents, two collision layers might be sufficient. It's very much depending on your scenario.

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

1 Person is following this question.

avatar image

Related Questions

Compound colliders on triangle shapes 2 Answers

physics.OverlapSphere colliders 1 Answer

How are compound colliders used? 0 Answers

Script is only working when slowing down timescale 0 Answers

What are best practices for getting your character to not fall through the floor? 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