- Home /
Checking Object Collision Without Script
Is there a way to check if an object is colliding with something without having a script on that particular object. Like so:
Transform other = null;
void Update () {
if(other.collider.isColliding){
//Rest of code in here
}
}
Is there a way to do that? Or would I have to put a script on that object and use OnCollisionEnter()
?
Answer by robertbu · Jan 21, 2013 at 06:45 PM
Take a look at the Physics class. They have several methods that will allow you to make tests: OverlapShpere(), CapsulCast(), SphereCast(), CheckSphere() and the like that allow you to test for colliders in a particular area.
Yeah, but I was thinking that would kill the fps. What would be better though? A script using only OnCollisionEnter on 200+ objects, or using a SphereCast() on all of them?
Your answer
Follow this Question
Related Questions
How to see object through collision? 0 Answers
OnCollisionEnter function problem. JS 2 Answers
Detect collision with specified object 1 Answer
Collision script 1 Answer
Unparent object on collision? 3 Answers