Skip to content

Instantly share code, notes, and snippets.

@jm
Created October 26, 2019 17:48
Show Gist options
  • Select an option

  • Save jm/33f668b88ac7d3fc34577c931d83c5c0 to your computer and use it in GitHub Desktop.

Select an option

Save jm/33f668b88ac7d3fc34577c931d83c5c0 to your computer and use it in GitHub Desktop.

Revisions

  1. jm created this gist Oct 26, 2019.
    18 changes: 18 additions & 0 deletions 3d_condition.cs
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,18 @@
    using UnityEngine;
    using System.Collections;
    using UnityEngine.Events;

    [AddComponentMenu("Playground/Conditions/Condition Collision")]
    [RequireComponent(typeof(Collider))]
    public class ConditionCollision : ConditionBase
    {
    // This function will be called when something touches the trigger collider
    void OnCollisionEnter(Collision collision)
    {
    if(collision.collider.CompareTag(filterTag)
    || !filterByTag)
    {
    ExecuteAllActions(collision.gameObject);
    }
    }
    }