- Home /
How to check if an object is colliding with another from another script ?
I would want to know if it is possible to know if an object is colliding with another from at a specific frame, doing something like that :
obj1.isCollidingWith(obj2);
I would want to do this without attaching a script to obj1 nor obj2, because I don't know which objects I want to check together.
Answer by rutter · Nov 06, 2013 at 02:14 AM
Doesn't work that way, I'm afraid. See this thread.
You could write a very generic OnCollisionEnter() that populates a data table. You can attach scripts from code using AddComponent(). At the end of the day, though, you need to attach some script to catch those collision events.
Rahh, this is what I was afraid of. Too bad. I just wanted to make sure. Thanks.
darn. they should really add a flag for colliders that is true if there is any collision.
its probably easiest to make a generic script for oncollisionenter and exit that sets it and put it on everything.
Your answer
Follow this Question
Related Questions
C# Plane Collision Detection 1 Answer
C# Collision Detection Help 0 Answers
C# GameObject is not detecting collision with Character Controller 2 Answers
C# -- Build character unit from script 1 Answer
C# Input.GetKey("Tab") Double Tap 1 Answer