Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Passing the effect of a collision to another object

Discussion in 'Physics' started by JeffersonTD, May 16, 2020.

  1. JeffersonTD

    JeffersonTD

    Joined:
    Feb 5, 2013
    Posts:
    268
    Goal: I would like to use one object merely as a collision detector and pass its information to another object that would then act as if it would collide with the object the detector was colliding with.

    Problem: My assumption was that I would be able to just use OnCollisionStay and use the collisions's collision.impulse for this purpose. I was expecting potential trial and error steps with adjusting the impulse's strength, frame-specific timing or applying it to Unity's CharacterController (which I maybe shouldn't ultimately use to begin with), but I seem to have more profound problems with this:
    • for some reason the impulse is usually (but not always) a plain 0 vector.
    • when it's not 0, the impulse's direction seems weird. Often it seems to be upwards, even if I'm bumping into a wall horizontally.

    So is there something I'm missing with how the Collision.impulse is to be used? Or should I try some other approach? I've set the "detector"'s rigid body to have all freeze position and freeze rotation constraints on as I don't want it to be effected, but it should still get the collision impulses, right?