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 pdunton · Feb 01, 2014 at 04:22 AM · javascriptcollider

Collider Filtering

Ok, so I have four characters that have to work together to defeat the evil cylinders. There names are Red, Blue, Yellow, and Green. They each have an ability, but they need to work together. Red's is a flamethrower, Blue's is a water gun, Green's is a Cannon, and Yellow's is a shield. Currently, only Green's and Yellow's powers are buggy. I want the other players to enter Yellow's shield, but right now they can't. I need to be able to keep the collider because I need something for the cylinders to interact with. So basically the players need to be able to enter the shield, but not the cylinders.

And with the Green's CannonBalls, the can currently hit other players and Yellow's shield and send them flying off of the level. This is not good. I want the CannonBalls to not do this. Either bounce off the players, or destroy themselves once they hit a player, or just stop their momentum all together. Just stop it from moving the players. Again these need to be able to hit the cylinders. Thanks for helping!

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 supernat · Feb 01, 2014 at 04:44 AM 0
Share

Please remove the spacing from the front of your sentences. It's being read as code and is unreadable currently.

1 Reply

· Add your reply
  • Sort: 
avatar image
0

Answer by Invertex · Feb 01, 2014 at 05:04 AM

Use Physics.IgnoreCollision(playerCollider,yellowCollider);, in the scripts Start() function to have it ignore collision between the colliders.

http://docs.unity3d.com/Documentation/ScriptReference/Physics.IgnoreCollision.html

If you're using the 2D system, you need to have the objects the colliders are on, in different Layers, so that you can use Physics2D.IgnoreLayerCollision(layer,layer); to Ignore their collisions. (though this will supposedly be fixed in the next update where we will get a Physics2D.IgnoreCollision() function.)

Comment
Add comment · Show 6 · 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 pdunton · Feb 01, 2014 at 05:12 AM 0
Share

Why exactly do I have to add a new Layer?

avatar image Invertex · Feb 01, 2014 at 06:36 AM 0
Share

Oops, I was describing the method for 2D at first, then thought you were probably not using 2D so I changed it up mid way through, lol. Fixed.

avatar image Invertex · Feb 04, 2014 at 03:53 AM 0
Share

Did this work for you?

avatar image pdunton · Feb 05, 2014 at 01:56 AM 0
Share

Uhhh, I have tried this.... and no it does not work for me. Here is the script that I used. (it has some other properties on it so just ignore those).

 #pragma strict
 public var shield : GameObject;
 public var redCollider : Collider;
 public var yellowCollider : Collider;
 public var blueCollider : Collider;
 public var greenCollider : Collider;
 function Start () {
     Physics.IgnoreCollision(redCollider, shield.collider);
     Physics.IgnoreCollision(yellowCollider, shield.collider);
     Physics.IgnoreCollision(blueCollider, shield.collider);
     Physics.IgnoreCollision(greenCollider, shield.collider);
 }
 
 function Update () {
 shield.SetActive(Input.Get$$anonymous$$ey($$anonymous$$eyCode.N));
 }
avatar image Invertex · Feb 05, 2014 at 03:20 AM 0
Share

Just to be clear, you're using regular colliders, not the one's in the 2D section correct?

Show more comments

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

20 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

Related Questions

Can someone help me fix my Javascript for Flickering Light? 6 Answers

Script doesn't find other script 0 Answers

Need some help an object collider that stops a timer then displays it on another scene 1 Answer

TimeScale collider, where all the time outside is frozen? 1 Answer

If Raycast Hits Air 4 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