Search Unity

Odd behaviour between non colliding objects

Discussion in 'Physics' started by Darkkingdom, Aug 1, 2019.

  1. Darkkingdom

    Darkkingdom

    Joined:
    Sep 2, 2014
    Posts:
    81
    Hey guys,

    I currently have a very strange problem with my 2D physics.

    The problem:

    In my game exists an ability which catapults the player as well as en emys straight in the air.
    It works fine if I only catapult the player or enemys. But as soon as I'm throwing them both in the air the (only) player stops his velocity midair and drops way too early to the ground. It's as they collide but the thing is there layers shouldn't be able to collide since it's disabled in the collision matrix.

    Facts:

    • Both of them have dynamic Rigidbodys with continues collision detection.

    • They are both on different collision layers and according to the matrix shouldn't be able to collide

    • I throw them with this line in the air:
      Code (CSharp):
      1. GetComponent<Rigidbody2D>().AddForce(Vector2.up * catapultForce);
    • None of my script lines removes the velocity of the player. Trust me I've been looking for over 8 hours.

    • Trigger/CollisionEnter doesn't trigger one any of them at when the player loses his momentum.

    • The problem doesn't happen when I'm trying to debug the moment with visual studio breakpoints or skipping the frames in the editor. Maybe because of FixedUpdate?

    • None of them is effected by an PhysicsEffector. Since I read that Effectors can overwrite the collision matrix.

    I have absolut no clue what else I could check.
    The problem is pretty annoying since the ability is supposed to be a gateway for aircombos like in Devil May Cry.
    Does anyone have any ideas?


    Thank you very much in advance :)!
     
  2. MelvMay

    MelvMay

    Unity Technologies

    Joined:
    May 24, 2013
    Posts:
    11,500
    Are you sure it's from a contact? In the Physics 2D settings select "Gizmos > Show Collider Contacts" which will draw arrows indicating contacts. Using this you can pause and single step and look to see if a contact appears. You can also click on the respective object, look in the inspector at the Rigidbody2D/Collider2D and open the "Info" rollout to see contacts.

    Alternately, you can dump your zipped project here or host it yourself and send me a link and I'll take a quick look.
     
    Darkkingdom likes this.