Search Unity

Custom 2D Polygon Trigger that works without rigidbodies

Discussion in 'Works In Progress - Archive' started by KEELAN, Aug 31, 2014.

  1. KEELAN

    KEELAN

    Joined:
    Oct 26, 2013
    Posts:
    51
    Hi all,
    I am working on my first asset for the store. It is a custom polygon trigger that does not require a Rigidbody2D and works solely on colliders, but it still works the same way with the following functions;

    Called once for every object that enters the trigger attached to this object

    void CustomOnTrigger2DEnter(Collider2D c)
    {
    //Do stuff on entry​
    }​

    Called once for every object that exits the trigger attached to this object

    void CustomOnTrigger2DExit(Collider2D c)
    {
    //Do stuff on exit​
    }​

    Called once for every object currently inside the trigger attracted to this object

    void CustomOnTrigger2DStay(Collider2D c)
    {
    //Do stuff while inside​
    }​

    There are also functions to get a list of every object that entered on that frame,
    and a list of every object currently inside the trigger.

    The asset will come with a basic scene editor to move points of the polygon by pressing shift while selecting the object and dragging the handles (see attached picture).

    The asset should be put up within the next few days and will cost $5

    Hope this will be of use to someone.
    Cheers
     

    Attached Files:

    nirs777 likes this.
  2. KEELAN

    KEELAN

    Joined:
    Oct 26, 2013
    Posts:
    51
    Currently waiting for approval. I sent it in yesterday :)