Search Unity

  1. Unity Asset Manager is now available in public beta. Try it out now and join the conversation here in the forums.
    Dismiss Notice

Physx Contact Modification

Discussion in '2021.2 Beta' started by hippocoder, Jul 28, 2021.

  1. hippocoder

    hippocoder

    Digital Ape

    Joined:
    Apr 11, 2010
    Posts:
    29,723
    Is it expected that pair.GetNormal() returns Mathf.Infinity or 0 sometimes? It only happens where ground colliders are overlapping (say box colliders as part of a level).

    When this occurs I often get normals that are NaN or 0, and need to know if it's actually expected from this API.
     
    NotaNaN likes this.
  2. hippocoder

    hippocoder

    Digital Ape

    Joined:
    Apr 11, 2010
    Posts:
    29,723
    For example:

    As the character falls under gravity, it has the potential to have contacts from a nearby slope that intersects the ground slightly so it will get contacts from that, but sets the normal as 0,0,0 or infinite, which is just not useful as a replacement for OnCollisionStay which does not exhibit this behaviour, and makes me suspect it is a potential bug.

    As I'm not familiar with Physx contact modifications. I can't be sure. Obviously a contacts normal of 0,0,0 should never actually happen, right?
     
    NotaNaN and Ruchir like this.
  3. rz_0lento

    rz_0lento

    Joined:
    Oct 8, 2013
    Posts:
    2,361
    Can you explain this in more detailed manner? I mean I don't fully understand what you have there now. Are you getting contact pairs between the ground colliders or between your character and ground collider?
     
  4. creat327

    creat327

    Joined:
    Mar 19, 2009
    Posts:
    1,756
    Can you show the code? I'm not sure how to reproduce what you are saying