Search Unity

collision detection 2d with animation's gameObject

Discussion in '2D' started by MrJohny, Apr 8, 2015.

  1. MrJohny

    MrJohny

    Joined:
    Feb 19, 2015
    Posts:
    73
    HI how it is the collision detection with 2D? Because when tested on standard objects that scrip:

    Code (JavaScript):
    1.     `var prekazka = gameObject;
    2.     function Start () {
    3.     }
    4.     function OnCollisionEnter2D(coll: Collision2D) {
    5.     if (coll.gameObject.tag == "tag"){
    6.     prekazka.transform.position.x = 80;
    7.     }
    8.     }`
    all work fine, BUT when i use object with animation or "scrolling" script, collision detection cant work... how to use it? i making 2d gameI need to make objects move to that location in collision detection/enter/exit... Thanks
     
  2. Ivanskodje

    Ivanskodje

    Joined:
    Mar 29, 2015
    Posts:
    57
    Weird... Did you use the Animator/Animation tool or did you manually script the entire animation? How is it handled?
    This is very weird as I have had no problems with collisions and animations, as I do not believe they directly interact with each other :S
     
  3. Jonathan-Watkins

    Jonathan-Watkins

    Joined:
    Mar 10, 2015
    Posts:
    125
    Do you have Animate Physics enabled on your Animation/Animator Component?