- Home /
Collider just for Tag (2D) (C#)
This is aggain a pretty basic Question I guess, but I can't figure out how to do this:
I want to use a 2D Boxcollider to check for collision with a tag with
void OnCollisionEnter2D (Collision2D something) {
if (something.collider.tag == "someTag")
//do something
}
But I dont want my Objects to actually collide. So basically what I want is to check if my player is at a certain position (not via transform or something like that), but I want to be able to walk past or through that collider...
Any Tips?
Thanks
Answer by KellyThomas · Jan 11, 2014 at 02:14 PM
It sounds like you want a Trigger
.
Here is a video that covers the trigger concept using the standard (3D) physics system as an example.
You will find they work pretty much the same over in the 2D space, but be aware that you will need to use the 2D suffix e.g. OnTriggerEnter2D()
Your answer
Follow this Question
Related Questions
Object following a path and colliding with other objects with physics. 1 Answer
Respawn Die Script (C#) 1 Answer
Checking for collision with 2D objects/sprites 3 Answers
2D Collision problem 1 Answer