Trying to register two colliding objects without the physics engine taking over

I’m trying to get messages sent when two objects collide but I don’t want either of these objects to react to collisions as though they have actually collided. They’re supposed to be invisible collision detectors but I can only get them to register if one of the other bodies has a rigidbody component which as you all know forces a physics reaction.

Is there a way to get to objects to collide and not have the physics engine bounce them around?

How about this: Your two object’s layers are set to something that cannot collide with each other. Then each of them has a child object that has its own rigidbody and collider and those two colliders can collide with each other.
Or you could do something like raycasting.

Let me tell you what i have understood from your post. You want each of the body to gets collided with other ones but not with each other. Correct me if i am wrong.

Thanks, guys.

Mmm but then wouldn’t the children undergo physics reactions? When they collide wouldn’t the children then bounce around? I can’t use raycasting because its just a line and I need to know if something has entered a volume.

I do want them to collide with everything but I don’t want any kind of physics reaction. I just need to know if something has entered a volume even if it is another invisible volume.

Basically, I’m trying to implement vision cones as physics objects. Imagine two soldiers walking around and they each have invisible vision cones which are actual cone shapes registered with colliders. Now when these two cones collide ie the soldiers cones have entered each other(think - each soldier sees the other’s flashlight beam) then they both receive messages.

I know I could use state machines for this and also my own volume calcs but I would really like to implement it using the physics engine so if anyone has any ideas that’d be great.

Have you tried setting isTrigger property of the collider to true and then registering your collisions in OnTriggerEnter(), or OnTriggerStay() or in OnTriggerExit()?

Sounds exactly like what triggers are for.

ravinder and HiPhish: Thanks for your help, guys. I was doing something wrong. I had ticked the isTrigger property but I suspect it was because my machine had been on for a couple of days (I run Unity on Windows) and it was exhibiting other weird behaviour. I restarted and changed the function to OnTriggerStay() and it started working as I thought triggers should. My fault.