Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice
  3. Join us on November 16th, 2023, between 1 pm and 9 pm CET for Ask the Experts Online on Discord and on Unity Discussions.
    Dismiss Notice

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?