Search Unity

C# Child on collision - like Arkanoid

Discussion in 'Scripting' started by kittik, Apr 27, 2015.

  1. kittik

    kittik

    Joined:
    Mar 6, 2015
    Posts:
    565
    Hi,

    I am trying to work out how to make a child on collision that sticks to an already moving paddle. As the code I am using is not in an void OnCollisionEnter2D(Collision2D coll) function, calling transform.parent = col.transform; is not going to work.

    My paddle has the tag of paddle and the child is tagged as character.

    Thanks in advance,

    Kittik
     
  2. SubZeroGaming

    SubZeroGaming

    Joined:
    Mar 4, 2013
    Posts:
    1,008
    Why couldn't you just grab the child objects parent and set it to the paddle transform? I don't think your question is quite clear.
     
  3. kittik

    kittik

    Joined:
    Mar 6, 2015
    Posts:
    565
    Thank you, that makes sense. I'll do that instead. Apologises that I didn't make myself clear.
     
    SubZeroGaming likes this.