Unity2D - Ignore collision with edge colliderCollisions in custom physics problemsCollision detection with bitmaps on SurfaceView's canvas in AndroidUnity3D: Recalculating collisions after Physics2D.IgnoreLayerCollision()?2D collision detection on html5 canvasCan a Polygon Collider 2D work with a Mesh Collider in Unity?How to detect collisions when using a GameObject collides with a BoxCollider 2D while being dragged on Unity 3DHow can I find on which side of an EdgeCollider2D (Unity 3D) a collision takes place?GameObject not detecting collision with floorAlternatives for updating mesh collider in runtime?Unity5 OnTriggerEnter2D not called after collision (2D game)CircleCollider2D is not registering collisions with some tiles in a TileMapCollider2D

Do universities maintain secret textbooks?

How did medieval manors handle population growth? Was there room for more fields to be ploughed?

Under GDPR, can I give permission once to allow everyone to store and process my data?

Small RAM 4 KB on the early Apple II?

How to understand payment due date for credit card?

How to investigate an unknown 1.5GB file named "sudo" in my Linux home directory?

Could a complex system of reaction wheels be used to propel a spacecraft?

Was a six-engine 747 ever seriously considered by Boeing?

Is it good practice to speed up and slow down where not written in a song?

Was it illegal to blaspheme God in Antioch in 360.-410.?

Is this homebrew "Faerie Fire Grenade" unbalanced?

Are sweatpants frowned upon on flights?

Can I lend a small amount of my own money to a bank at the federal funds rate?

Eshet Chayil in the Tunisian service

Storing milk for long periods of time

Find the logic in first 2 statements to give the answer for the third statement

Why haven't the British protested Brexit as ardently like Hong Kongers protest?

Which is the correct version of Mussorgsky's Pictures at an Exhibition?

Can inductive kick be discharged without freewheeling diode, in this example?

Are spot colors limited and why CMYK mix is not treated same as spot color mix?

Is "prohibition against," a double negative?

How can I portray a character with no fear of death, without them sounding utterly bored?

How were US credit cards verified in-store in the 1980's?

Why do presidential pardons exist in a country having a clear separation of powers?



Unity2D - Ignore collision with edge collider


Collisions in custom physics problemsCollision detection with bitmaps on SurfaceView's canvas in AndroidUnity3D: Recalculating collisions after Physics2D.IgnoreLayerCollision()?2D collision detection on html5 canvasCan a Polygon Collider 2D work with a Mesh Collider in Unity?How to detect collisions when using a GameObject collides with a BoxCollider 2D while being dragged on Unity 3DHow can I find on which side of an EdgeCollider2D (Unity 3D) a collision takes place?GameObject not detecting collision with floorAlternatives for updating mesh collider in runtime?Unity5 OnTriggerEnter2D not called after collision (2D game)CircleCollider2D is not registering collisions with some tiles in a TileMapCollider2D






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;








0















I am trying to have my player ignore the collision with an edge collider on a platform i have.



Here's the script that I have added to the player



public class TestMovement : MonoBehaviour

public Rigidbody2D ball;
private GameObject purplePlat1;
private GameObject player;

// Start is called before the first frame update
void Start()

purplePlat1 = GameObject.Find("purple_plat");
player = GameObject.Find("circle-png-44659");

ball = GetComponent<Rigidbody2D>();
ball.AddForce(new Vector2(0, 10), ForceMode2D.Impulse);
Debug.Log("start");


// Update is called once per frame
void Update()




void OnCollisionEnter2D(Collision2D collision)


Physics2D.IgnoreCollision(purplePlat1.GetComponent<EdgeCollider2D>
(), GetComponent<CircleCollider2D>());
Debug.Log("collision");





The ball is still hitting the platform. I have confirmed that the oncollisionenter method is firing.



enter image description here



enter image description here










share|improve this question
























  • You should just put the IgnoreCollision in Start(). It remains in effect until you set it to false.

    – ryeMoss
    Mar 27 at 23:34







  • 1





    on collision is called on the collision, in other words, too late to be ignored. its like telling people who come to your house not to come to your house. they are already there. you need to tell them before they come.

    – Tomer Shahar
    Mar 28 at 7:48

















0















I am trying to have my player ignore the collision with an edge collider on a platform i have.



Here's the script that I have added to the player



public class TestMovement : MonoBehaviour

public Rigidbody2D ball;
private GameObject purplePlat1;
private GameObject player;

// Start is called before the first frame update
void Start()

purplePlat1 = GameObject.Find("purple_plat");
player = GameObject.Find("circle-png-44659");

ball = GetComponent<Rigidbody2D>();
ball.AddForce(new Vector2(0, 10), ForceMode2D.Impulse);
Debug.Log("start");


// Update is called once per frame
void Update()




void OnCollisionEnter2D(Collision2D collision)


Physics2D.IgnoreCollision(purplePlat1.GetComponent<EdgeCollider2D>
(), GetComponent<CircleCollider2D>());
Debug.Log("collision");





The ball is still hitting the platform. I have confirmed that the oncollisionenter method is firing.



enter image description here



enter image description here










share|improve this question
























  • You should just put the IgnoreCollision in Start(). It remains in effect until you set it to false.

    – ryeMoss
    Mar 27 at 23:34







  • 1





    on collision is called on the collision, in other words, too late to be ignored. its like telling people who come to your house not to come to your house. they are already there. you need to tell them before they come.

    – Tomer Shahar
    Mar 28 at 7:48













0












0








0








I am trying to have my player ignore the collision with an edge collider on a platform i have.



Here's the script that I have added to the player



public class TestMovement : MonoBehaviour

public Rigidbody2D ball;
private GameObject purplePlat1;
private GameObject player;

// Start is called before the first frame update
void Start()

purplePlat1 = GameObject.Find("purple_plat");
player = GameObject.Find("circle-png-44659");

ball = GetComponent<Rigidbody2D>();
ball.AddForce(new Vector2(0, 10), ForceMode2D.Impulse);
Debug.Log("start");


// Update is called once per frame
void Update()




void OnCollisionEnter2D(Collision2D collision)


Physics2D.IgnoreCollision(purplePlat1.GetComponent<EdgeCollider2D>
(), GetComponent<CircleCollider2D>());
Debug.Log("collision");





The ball is still hitting the platform. I have confirmed that the oncollisionenter method is firing.



enter image description here



enter image description here










share|improve this question














I am trying to have my player ignore the collision with an edge collider on a platform i have.



Here's the script that I have added to the player



public class TestMovement : MonoBehaviour

public Rigidbody2D ball;
private GameObject purplePlat1;
private GameObject player;

// Start is called before the first frame update
void Start()

purplePlat1 = GameObject.Find("purple_plat");
player = GameObject.Find("circle-png-44659");

ball = GetComponent<Rigidbody2D>();
ball.AddForce(new Vector2(0, 10), ForceMode2D.Impulse);
Debug.Log("start");


// Update is called once per frame
void Update()




void OnCollisionEnter2D(Collision2D collision)


Physics2D.IgnoreCollision(purplePlat1.GetComponent<EdgeCollider2D>
(), GetComponent<CircleCollider2D>());
Debug.Log("collision");





The ball is still hitting the platform. I have confirmed that the oncollisionenter method is firing.



enter image description here



enter image description here







unity3d collision-detection






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Mar 27 at 23:08









JohnJohn

7510 bronze badges




7510 bronze badges















  • You should just put the IgnoreCollision in Start(). It remains in effect until you set it to false.

    – ryeMoss
    Mar 27 at 23:34







  • 1





    on collision is called on the collision, in other words, too late to be ignored. its like telling people who come to your house not to come to your house. they are already there. you need to tell them before they come.

    – Tomer Shahar
    Mar 28 at 7:48

















  • You should just put the IgnoreCollision in Start(). It remains in effect until you set it to false.

    – ryeMoss
    Mar 27 at 23:34







  • 1





    on collision is called on the collision, in other words, too late to be ignored. its like telling people who come to your house not to come to your house. they are already there. you need to tell them before they come.

    – Tomer Shahar
    Mar 28 at 7:48
















You should just put the IgnoreCollision in Start(). It remains in effect until you set it to false.

– ryeMoss
Mar 27 at 23:34






You should just put the IgnoreCollision in Start(). It remains in effect until you set it to false.

– ryeMoss
Mar 27 at 23:34





1




1





on collision is called on the collision, in other words, too late to be ignored. its like telling people who come to your house not to come to your house. they are already there. you need to tell them before they come.

– Tomer Shahar
Mar 28 at 7:48





on collision is called on the collision, in other words, too late to be ignored. its like telling people who come to your house not to come to your house. they are already there. you need to tell them before they come.

– Tomer Shahar
Mar 28 at 7:48












2 Answers
2






active

oldest

votes


















0















You can use the layer system of Unity to avoid collisions between both. Set a layer for a player and another for the edge and untick the collision between them.






share|improve this answer
































    0















    What you can do is create a layer mask for the different type of game objects. Then, open your Physics2D settings.



    Physics2D settings



    On the bottom part, you can see a matrix of physics objects that can collide to one another. Just uncheck which layer should not collide with the other.



    Matrix






    share|improve this answer



























      Your Answer






      StackExchange.ifUsing("editor", function ()
      StackExchange.using("externalEditor", function ()
      StackExchange.using("snippets", function ()
      StackExchange.snippets.init();
      );
      );
      , "code-snippets");

      StackExchange.ready(function()
      var channelOptions =
      tags: "".split(" "),
      id: "1"
      ;
      initTagRenderer("".split(" "), "".split(" "), channelOptions);

      StackExchange.using("externalEditor", function()
      // Have to fire editor after snippets, if snippets enabled
      if (StackExchange.settings.snippets.snippetsEnabled)
      StackExchange.using("snippets", function()
      createEditor();
      );

      else
      createEditor();

      );

      function createEditor()
      StackExchange.prepareEditor(
      heartbeatType: 'answer',
      autoActivateHeartbeat: false,
      convertImagesToLinks: true,
      noModals: true,
      showLowRepImageUploadWarning: true,
      reputationToPostImages: 10,
      bindNavPrevention: true,
      postfix: "",
      imageUploader:
      brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
      contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
      allowUrls: true
      ,
      onDemand: true,
      discardSelector: ".discard-answer"
      ,immediatelyShowMarkdownHelp:true
      );



      );













      draft saved

      draft discarded


















      StackExchange.ready(
      function ()
      StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55387846%2funity2d-ignore-collision-with-edge-collider%23new-answer', 'question_page');

      );

      Post as a guest















      Required, but never shown

























      2 Answers
      2






      active

      oldest

      votes








      2 Answers
      2






      active

      oldest

      votes









      active

      oldest

      votes






      active

      oldest

      votes









      0















      You can use the layer system of Unity to avoid collisions between both. Set a layer for a player and another for the edge and untick the collision between them.






      share|improve this answer





























        0















        You can use the layer system of Unity to avoid collisions between both. Set a layer for a player and another for the edge and untick the collision between them.






        share|improve this answer



























          0














          0










          0









          You can use the layer system of Unity to avoid collisions between both. Set a layer for a player and another for the edge and untick the collision between them.






          share|improve this answer













          You can use the layer system of Unity to avoid collisions between both. Set a layer for a player and another for the edge and untick the collision between them.







          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered Mar 28 at 0:27









          FollarinFollarin

          631 silver badge8 bronze badges




          631 silver badge8 bronze badges


























              0















              What you can do is create a layer mask for the different type of game objects. Then, open your Physics2D settings.



              Physics2D settings



              On the bottom part, you can see a matrix of physics objects that can collide to one another. Just uncheck which layer should not collide with the other.



              Matrix






              share|improve this answer





























                0















                What you can do is create a layer mask for the different type of game objects. Then, open your Physics2D settings.



                Physics2D settings



                On the bottom part, you can see a matrix of physics objects that can collide to one another. Just uncheck which layer should not collide with the other.



                Matrix






                share|improve this answer



























                  0














                  0










                  0









                  What you can do is create a layer mask for the different type of game objects. Then, open your Physics2D settings.



                  Physics2D settings



                  On the bottom part, you can see a matrix of physics objects that can collide to one another. Just uncheck which layer should not collide with the other.



                  Matrix






                  share|improve this answer













                  What you can do is create a layer mask for the different type of game objects. Then, open your Physics2D settings.



                  Physics2D settings



                  On the bottom part, you can see a matrix of physics objects that can collide to one another. Just uncheck which layer should not collide with the other.



                  Matrix







                  share|improve this answer












                  share|improve this answer



                  share|improve this answer










                  answered Mar 28 at 7:29









                  TrickoTricko

                  2111 silver badge5 bronze badges




                  2111 silver badge5 bronze badges






























                      draft saved

                      draft discarded
















































                      Thanks for contributing an answer to Stack Overflow!


                      • Please be sure to answer the question. Provide details and share your research!

                      But avoid


                      • Asking for help, clarification, or responding to other answers.

                      • Making statements based on opinion; back them up with references or personal experience.

                      To learn more, see our tips on writing great answers.




                      draft saved


                      draft discarded














                      StackExchange.ready(
                      function ()
                      StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55387846%2funity2d-ignore-collision-with-edge-collider%23new-answer', 'question_page');

                      );

                      Post as a guest















                      Required, but never shown





















































                      Required, but never shown














                      Required, but never shown












                      Required, but never shown







                      Required, but never shown

































                      Required, but never shown














                      Required, but never shown












                      Required, but never shown







                      Required, but never shown







                      Popular posts from this blog

                      Kamusi Yaliyomo Aina za kamusi | Muundo wa kamusi | Faida za kamusi | Dhima ya picha katika kamusi | Marejeo | Tazama pia | Viungo vya nje | UrambazajiKuhusu kamusiGo-SwahiliWiki-KamusiKamusi ya Kiswahili na Kiingerezakuihariri na kuongeza habari

                      Swift 4 - func physicsWorld not invoked on collision? The Next CEO of Stack OverflowHow to call Objective-C code from Swift#ifdef replacement in the Swift language@selector() in Swift?#pragma mark in Swift?Swift for loop: for index, element in array?dispatch_after - GCD in Swift?Swift Beta performance: sorting arraysSplit a String into an array in Swift?The use of Swift 3 @objc inference in Swift 4 mode is deprecated?How to optimize UITableViewCell, because my UITableView lags

                      Access current req object everywhere in Node.js ExpressWhy are global variables considered bad practice? (node.js)Using req & res across functionsHow do I get the path to the current script with Node.js?What is Node.js' Connect, Express and “middleware”?Node.js w/ express error handling in callbackHow to access the GET parameters after “?” in Express?Modify Node.js req object parametersAccess “app” variable inside of ExpressJS/ConnectJS middleware?Node.js Express app - request objectAngular Http Module considered middleware?Session variables in ExpressJSAdd properties to the req object in expressjs with Typescript