One-Way Collision Between RigidBodies




RigidBody_A CAN detect collision with RigidBody_B

RigidBody_B CANNOT detect collision with RigidBody_A

Is this collision possible to setup?

Any help will be greatful thanks!

Well what you're asking can't be generalized in any way. Actually do you mean physics collision response or do you mean the collision messages? The physics can't be setup that way. If there's a collision it has to be between TWO objects.

To prevent the collision message on one of those two objects i would give object B a referenc to object A, so it can determine when it collides with A.


var doNotCollideWithThat : GameObject;

function OnCollisionEnter(col : Collision)
    if (col.collider.gameObject != doNotCollideWithThat)
        // Hey, it's not Object A

You could have triggerspheres around both of them, and if they are in eachother's triggersphere turn them to kinematic. Then fake the physics.

This depends on what you want to do. You’ll have to give some more conditions, because like Bunny83 pointed out, two objects will always collide with eachother, never one object with another.

However, if one of the objects is at rest or have low velocity and the other collides into it with rather high velocity, that is something you could define as one-way collision. Now you can take the objects’ velocities into consideration.

You could for example script this scenario:

if RigidBody_A has greater velocity than RigidBody_B then collision is true
else, collision is false.

If you actually want to affect only one body from impact force (on both NON-Kinematic Rigidbodies), try setting the mass of the uneffected body to 0. This will prevent beeing able to push for object, but stop it.

An example would be physical camera movement. The camera should react to collisions, prevent clipping through objects, but is not allowed to push the player. Instead the player can push the camera away.