- Home /
How to test collision between 2 objects already colliding?
Is there an equivalent for rigidbody.SweepTest that works when the distance is set to 0 ?
Answer by temptest123 · May 28, 2013 at 08:40 PM
can't you just use OnCollisionEnter and OnCollisionExit to keep track of which objects currently are in contact?
Nope because I need to know the direction of the object in contact. It's collision between statics cubes, nothing fancy.
could you maybe use a sphereCast centered on one of them, and then make sure that it doesn't grab itself?
Not sure to completely understand what you said but this gave me an idea. I can stick 1 small cube on the 4 sides of each cube, then I can check which of the 4 small cubes are colliding. Not sure if it's clear so I've made a drawing : http://tof.canardpc.com/view/e83d3f20-41b0-4b60-962d-2f34cdc9dae9.jpg
It's not very elegant but it might work.
Answer by darthbator · May 28, 2013 at 08:54 PM
There is an OnCollisionStay method that should fire on any frame where 2 objects are touching. I believe this fires on every frame other then the frame where the collision occurs and the frame where the collision ends.
Your answer
![](https://koobas.hobune.stream/wayback/20220613103107im_/https://answers.unity.com/themes/thub/images/avi.jpg)