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 laurienash · Jun 10, 2013 at 12:11 AM · collisionphysicslayers

Physics ignore layer collision script error

Hi - sorry this is very simple (I know there's lots of similar questions on the forums but I can't find one that works)

I just need my collider to ignore all collisions from layer 8.

This is the script I wrote (JavaScript):

 var layer8 : int;
 var ignore : boolean = true;
 
 
 
 function Update () {
 
 Physics.IgnoreLayerCollision(layer8, true);
 
 }

But I get the error BCE0023: No appropriate version of 'UnityEngine.Physics.IgnoreLayerCollision' for the argument list '(int, boolean)' was found.

Do you know what I'm doing wrong?

Thanks, Laurien

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

3 Replies

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

Answer by InfiniBuzz · Jun 10, 2013 at 12:21 AM

Hi

the Physics.IngoreLayerCollision()-Method is used to disable collision between two layers. With your code, the Physics engine don't know which objects should be ignored for collision with layer8.

try

 Physics.IgnoreLayerCollision (layer8, otherLayer);

you probably want to do this for all the layers that you want to be ignored

 Physics.IgnoreLayerCollision (layer8, layerOne);
 Physics.IgnoreLayerCollision (layer8, layerTwo);
 Physics.IgnoreLayerCollision (layer8, layerThree);

If you never need collision with layer8 you can just remove the Collider-components from the GameObjects on layer8.

PS - the error you get is because you try to pass inappropriate parameters to the function. So when coding you can type Physics.IngnoreLayerCollision and as soon as you type the bracket there will be anpther popup (tooltip) that shows you all the overloads for this method and its parameters. This can help you to avoid errors like this.

I hope this is what you are looking for.

Comment
Add comment · Show 1 · 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 laurienash · Jun 10, 2013 at 11:32 AM 0
Share

Thanks - I understand how it works now. (I need to keep the colliders because they've got another function) - but it's working now - thanks again :)

avatar image
0

Answer by Mukabr · Jun 10, 2013 at 12:19 AM

The Physics.IgnoreLayerCollision function receive as params int named layer1, another int named layer2, and a boolean called ignore

this is the function :

 Physics.IgnoreLayerCollision(int layer1, int layer2, bool ignore);

You're forgetting the second param, layer2.

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 diverseer · Jan 19, 2017 at 09:03 PM

Use integer in Physics.IgnoreLayerCollision(8, 10); u need integer not like that (layer8, layer10);

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.

Follow this Question

Answers Answers and Comments

17 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

Related Questions

How to achieve this basic physics effect? Detect when to change layers 2 Answers

Does the "Layer Collision Matrix" affect triggers? 1 Answer

Layer Collision in Networks (Mulitplayer Game). 0 Answers

Button to change layers 1 Answer

Layers are colliding even though they are set to ignore each other 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