Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice

Question Triggers... with no physics please..

Discussion in 'Physics' started by Jelmer123, Aug 31, 2023.

  1. Jelmer123


    Feb 11, 2019
    2D Game with sprites: I want to notice when sprites hit/touch each other but I don't want any physics stuff to happen.

    All have 2D colliders with Trigger switched on. But still I need to add a rigidbody to one of them, and it apparently can't be on static mode, and thus I am forced to use physics anyway! Is there another way?
  2. MelvMay


    Unity Technologies

    May 24, 2013
    Triggers are part of physics.

    The only thing that moves in physics is a Rigidbody2D, use its API to cause movement.

    More likely you mean that Static do not collide with Static. You can use Kinematic and turn-on Rigidbody2D.useFullKinematicContacts which will start producing contacts for when a Kinematic/Kinematic or Kinematic/Static come into contact (you'll get callbacks). Typically a Kinematic Rigidbody2D will only contact a Dynamic Rigidbody2D.

    • Dynamic contacts Static, Kinematic and Dynamic.
    • Kinematic doesn't contact Kinematic or Static (unless useFullKinematicContacts is on).
    • Static never contacts Static!

    You then use Rigidbody2D.MovePosition as you normally would to move the body.

    A collider with no Rigidbody2D is implicitly static and it's attached to the hidden Rigidbody2D that lives at the world origin. The downside is that you can no way to move this kind of collider (you shouldn't anyway, it's Static i.e. non-moving) so you end up modifying the Transform which is something you should never ever do.
    Jelmer123 likes this.