Search Unity

  1. Are you interested in providing feedback directly to Unity teams? Sign up to become a member of Unity Pulse, our new product feedback and research community.
    Dismiss Notice

Get Positions of Bones During Animation Clip

Discussion in 'Animation' started by Ecliptec_Mobile, Jul 22, 2021.

  1. Ecliptec_Mobile

    Ecliptec_Mobile

    Joined:
    Dec 17, 2017
    Posts:
    8
    I would like to measure the distance between two bones on separate characters. I am attempting to query the transform.position of the bone(s) and determine distance using Vector3 methods. However, it seems that the positions of the bones are giving strange/erroneous numbers during runtime and postions are not changing in the Editor.

    How can I get the correct world position of a bone in the heirarchy of a bone during an animation clip?
     
  2. Kybernetik

    Kybernetik

    Joined:
    Jan 3, 2013
    Posts:
    1,760
    Transform.position should do it. There's likely something else wrong with your code.
     
  3. Ecliptec_Mobile

    Ecliptec_Mobile

    Joined:
    Dec 17, 2017
    Posts:
    8
    It turns out I was querying position in a coroutine, so it was (occasionally) giving apurious results. I moved my code LateUpdate() and it's workin as expected.
     
unityunity