detect WHEN static objects collider is IN collision with instantiated objects collider also static..

I have an issue where I need to have an if statement check if 2 colliders are touching but neither collider moves. the 2nd object in question will be instantiated in such a way that it will be colliding with object 1 when instantiated and I need to have a function execute only if the two are not colliding. It seems impossible to have two stationary objects detect if they are touching. Any ideas?

By static you mean just not moving, or do you mean it is marked as static?

1 Like

If the second collider is a box, sphere or cylinder, you can use Physics.OverlapBox/Sphere/Cylinder to check the spot it’s going to end up on.

If they’re more complex meshes, you can check if their bounds overlap. Bounds are an axis aligned box that contains the meshes, so the bounds might overlap even if the meshes don’t. But you’re guaranteed that the two meshes don’t overlap if their bounds don’t overlap.

1 Like

object 1 is marked static object 2 is an animating object which is stationary and does not move. both have box colliders for on mouse down purposes. since they don’t move rigidbody will not work. basically I need to check on mouse down if object1 is colliding with another object, if it is you will be unable to instantiate object 2 over it.