Search Unity

Action game

Discussion in 'Scripting' started by vahab2, Dec 20, 2009.

  1. vahab2

    vahab2

    Joined:
    Nov 12, 2009
    Posts:
    11
    how can i attach a sword in the hand of player ?
     
  2. GargerathSunman

    GargerathSunman

    Joined:
    May 1, 2008
    Posts:
    1,571
    Drag the sword into the scene, make it a child of the bone in charge of that hand, move it until it's positioned in the hand, and create an empty game object. Move that empty exactly where the sword is and store a reference to it inside the script in charge of activating the sword. Then, you can just place the sword at that empty's position and rotation, and make it a child of the empty.

    From that point on it will follow the hand bone perfectly.

    If you don't have a hand bone, do the same with the mesh object.