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;
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.
unity3d collision-detection
add a comment |
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.
unity3d collision-detection
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
add a comment |
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.
unity3d collision-detection
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.
unity3d collision-detection
unity3d collision-detection
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
add a comment |
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
add a comment |
2 Answers
2
active
oldest
votes
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.
add a comment |
What you can do is create a layer mask for the different type of game objects. Then, open your 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.
add a comment |
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
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
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
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.
add a comment |
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.
add a comment |
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.
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.
answered Mar 28 at 0:27
FollarinFollarin
631 silver badge8 bronze badges
631 silver badge8 bronze badges
add a comment |
add a comment |
What you can do is create a layer mask for the different type of game objects. Then, open your 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.
add a comment |
What you can do is create a layer mask for the different type of game objects. Then, open your 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.
add a comment |
What you can do is create a layer mask for the different type of game objects. Then, open your 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.
What you can do is create a layer mask for the different type of game objects. Then, open your 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.
answered Mar 28 at 7:29
TrickoTricko
2111 silver badge5 bronze badges
2111 silver badge5 bronze badges
add a comment |
add a comment |
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.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
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
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
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
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