AR Collision between two gameObejcts

hello,
I’m starting off with AR and wanted to know how can we detect collision between two Game Objects in AR. Thanks!

OnCollisionEnter and other GameObject physics operations work the same way in AR as any other Unity scene: Unity - Scripting API: Collider.OnCollisionEnter(Collision)

Thanks for your reply. I was thinking the same. But for some reason my objects don’t. The white cube is a spawned object whereas the red one is to be destroyed. I did some tests where after removing the spawn script, the red one does get destroyed on collision.

8524292--1137128--IMG_4252.PNG.jpg

If you are using AR Foundation 5.0, I recommend testing your scene using XR Simulation so you can more easily debug your scene in the Editor. A common cause for OnCollisonEnter not firing is that one of the objects is missing a Collider (both objects need a Collider) or one object doesn’t have a RigidBody (at least one object needs a non-kinematic RigidBody)

Thanks. I will check it out and update

I redid the entire thing and the problem was resolved. Thanks!

1 Like