Search Unity

Bug GameObject transform position does not update during game and remains at starting position

Discussion in 'Editor & General Support' started by farazk86, Jun 7, 2020.

  1. farazk86

    farazk86

    Joined:
    May 31, 2017
    Posts:
    195
    https://imgur.com/JcNNdhj

    As can be seen, the game object is a ragdoll, it is not a child to anything and is at top level in scene. The transform does not change as it falls.

    Is this a bug? I'm on Unity 2019.3.2f1

    Thanks
     
  2. PraetorBlue

    PraetorBlue

    Joined:
    Dec 13, 2012
    Posts:
    7,909
    I'm guessing some child of this object is the thing that's actually moving, as the only components on this object are your two custom scripts.
     
    farazk86 likes this.
  3. neginfinity

    neginfinity

    Joined:
    Jan 27, 2013
    Posts:
    13,571
    Most likely you've attached rigidbody as a child component of the object you're tracking.
    Rigidbodies do not move their parents. They only move themselves and their children..

    Put the rigidbody component as object root, and that should solve it.
     
    farazk86 likes this.
  4. farazk86

    farazk86

    Joined:
    May 31, 2017
    Posts:
    195
    Thanks for the replies.

    Yes you are correct. The rigidbodies are on the children bone components as this is a ragdoll.

    In case of ragdolls how would I monitor its movement? I want to check if the parent gameobject is below a certain poisition by the following script:

    Code (CSharp):
    1. void Update()
    2.     {
    3.         if (transform.position.y < 1.5f)
    4.         {
    5.             gameManager.gameOver = true;
    6.         }
    7.     }