Search Unity

C# How can I return the vector3 for the position of a joint on an FBX?

Discussion in 'Scripting' started by From-Soy-Sauce, Sep 2, 2014.

  1. From-Soy-Sauce

    From-Soy-Sauce

    Joined:
    Jan 7, 2014
    Posts:
    162
    Hello, I've got a wizard character, and I want to make it so that he creates fire balls from his hand. But I don't know how to get the position of his hand joint. I would like to know if it is possible, and if so, how?
     
  2. smitchell

    smitchell

    Joined:
    Mar 12, 2012
    Posts:
    702
    you could just create a empty gam object and attach it to his hand?
     
  3. From-Soy-Sauce

    From-Soy-Sauce

    Joined:
    Jan 7, 2014
    Posts:
    162
    But how do I know where the hand is?
     
  4. smitchell

    smitchell

    Joined:
    Mar 12, 2012
    Posts:
    702
    shouldn't you be able to see all the bones in the hierarchy? just make the empty GO a child of the hand bone
     
  5. From-Soy-Sauce

    From-Soy-Sauce

    Joined:
    Jan 7, 2014
    Posts:
    162
    I want to know how to do that in C# code because I do not like operating games by menus.
     
  6. smitchell

    smitchell

    Joined:
    Mar 12, 2012
    Posts:
    702
  7. From-Soy-Sauce

    From-Soy-Sauce

    Joined:
    Jan 7, 2014
    Posts:
    162
    That is something completely different.

    Like you were saying about earlier with how you can see the bones in the heirachy, I've got a bone named "handL" and I would like to know if there is a way to code in C# to use that name to return the x,y, and z positions of that bone.
     
  8. smitchell

    smitchell

    Joined:
    Mar 12, 2012
    Posts:
    702
    oh then yeah if you know the name etc then you can just do something like:

    Code (CSharp):
    1. Vector3 bonePosition = GameObject.Find ("handL").transform.localPosition;