Search Unity

move = rotate (GameObject)

Discussion in 'Animation' started by josemauriciob, Jan 30, 2015.

  1. josemauriciob

    josemauriciob

    Joined:
    Mar 5, 2009
    Posts:
    662
    Hi every one...!

    i need when moves a gameobject, then rotates another gameobject

    I almost done, but, the rotation gameobject, never stop to rotate.

    here is my code

    Code (JavaScript):
    1.  
    2. var rotatecube : GameObject;
    3. var mycube : Vector3;
    4.  
    5. function Update () {
    6. mycube = GameObject.FindGameObjectWithTag("cubito").transform.position;
    7.  
    8. rotatecube.transform.Rotate(mycube);
    9. }
    10.  
    in other words, i need to rotate a gameobject, acording moves the other gameobject, and , the most important
    when the first gameobject stop moving,... i need the second gameobject stop rotate to.

    only rotate second gameobject, if first gameobject moves..... if not moves , dont rotate.

    if first gameobjects move to the right... then second gameobject rotates clockwise (CW)
    if the first object moves to the left... then second gameobject rotates in reverse clockwise (CCW)
    and if moves up..... bla bla bla... and if move down ... bla bla bla... etc,etc....

    please help.
     
  2. josemauriciob

    josemauriciob

    Joined:
    Mar 5, 2009
    Posts:
    662
    any help ?
    thanks
     
  3. josemauriciob

    josemauriciob

    Joined:
    Mar 5, 2009
    Posts:
    662
    please any idea ?
     
  4. josemauriciob

    josemauriciob

    Joined:
    Mar 5, 2009
    Posts:
    662
  5. josemauriciob

    josemauriciob

    Joined:
    Mar 5, 2009
    Posts:
    662
    some help please ?
     
  6. josemauriciob

    josemauriciob

    Joined:
    Mar 5, 2009
    Posts:
    662
    some help please ?
     
  7. josemauriciob

    josemauriciob

    Joined:
    Mar 5, 2009
    Posts:
    662