Search Unity

My enemy falls through floor using Rigidbody2D n Collider with checked "Is Trigger" at the same time

Discussion in 'Physics' started by tallesmaziero, Jul 20, 2018.

  1. tallesmaziero

    tallesmaziero

    Joined:
    Feb 3, 2018
    Posts:
    19
    I googled it a lot but i was unable to find a solution to this.

    i have an enemy and i attached Rigidbody2D to it to have gravity, it patrols an area and has to go up and down slopes, that's why the rigidbody2d is attached, to use gravity.

    At the same time a want to use with it a CircleCollider2D as a trigger, to have combat.

    I need my player to pass through this enemy.

    But at the moment i set the collider as a trigger my enemy falls through the floor.

    The floor also has a composite collider on it and a rigidbody2d.

    There is any way to work around this?

    ps: i'm using c# if i need any coding.
     
  2. Antypodish

    Antypodish

    Joined:
    Apr 29, 2014
    Posts:
    10,778
    Is trigger in general ignores collisions.
    You may need different solution, or secondary collider.
     
  3. FMark92

    FMark92

    Joined:
    May 18, 2017
    Posts:
    1,243
    Second collider is the way to go here.
    Also that is a well concealed prostate massager in the avatar.