Question by
Johannes_Kepler1 · Dec 19, 2015 at 03:03 PM ·
collisioncollision detectioncollider2d
How to check if a collider is Touching any other object
I am creating a game in which if at any point an object is touching another object then it needs to stop. Rather than a specific if coll.gameObject.tag == "Enemy" for example is it possible to create a boolean value upon the condition that the player's object is touching any other object. Just to stipulate it is a 2D game, Thank You.
Comment
Answer by Becel10 · Dec 19, 2015 at 07:59 PM
You search to do it in another way than "coll.gameObject.tag " ?
Answer by MelvMay · Dec 20, 2015 at 11:48 AM
You can use the IsTouching & IsTouchingLayers calls.
http://docs.unity3d.com/ScriptReference/30_search.html?q=istouching