Search Unity

unique problem regarding equiping of a character...please help

Discussion in 'Scripting' started by matthew77, Sep 15, 2017.

  1. matthew77

    matthew77

    Joined:
    Dec 17, 2016
    Posts:
    29
    Hi. I'm not sure this is the proper place in the forums for this question but I feel that if there is anyway to resolve the issue it'd be through scripting.

    I need to be able to equip my players with things like food and drinks. So if they click on a food item it will place the item in their hand. I've seen online tutorials for things like this, however my problem is that I'm remotely loading the character through another program that loads on startup of the game. Specifically IMVU for unity. As such there are no "bones" listed in the hierarchy for me to attach the items to.

    They do seem to be listed in a "ragdoll" script. Would there be any way to make this work or is it just hopeless?

    Thanks in advance.
     
  2. RoMax92

    RoMax92

    Joined:
    May 29, 2017
    Posts:
    135
  3. matthew77

    matthew77

    Joined:
    Dec 17, 2016
    Posts:
    29
    Um thanks for the response but this doesn't address my problem.
     
  4. lordconstant

    lordconstant

    Joined:
    Jul 4, 2013
    Posts:
    389
    When you say they do seem to be listed in a "ragdoll" script I assume you are refering to the bones?

    If so just grab the bone you want at runtime to attach stuff to.

    You should also grab a character to have as default incase of any server issues.
     
  5. matthew77

    matthew77

    Joined:
    Dec 17, 2016
    Posts:
    29
    Thanks for the response. Could you elaborate on the bolded part a little?
     
  6. lordconstant

    lordconstant

    Joined:
    Jul 4, 2013
    Posts:
    389
    In the ragdoll script you said it listed the bones I would expect you can do something like:

    Code (CSharp):
    1. Ragdoll myRagdoll = GetComponent<Ragdoll>();
    2. Bones[] boneArr = myRagdoll.GetBones();
    3.  
    Class names & functions are assumed, but I expect the Ragdoll has some sort of bone class or skeleton class that has the bones. Then each bone may have a unique identifier like bone.type or bone.id so you can work out which you need.

    Just look at the ragdoll script, find the Bone class or whatever bonea are stored as then look at that class to see what you've got to work with.

    If you cant get to the bone class just do "Bone." & look at your auto complete options