First i declare the sword object and the arm object that holds the sword in the editor.
public Transform sword;
public Transform swordarm;
If the player is not attacking then the sword is in the sheath.
if (attacking == 0)
{
sword.parent = transform;
sword.transform.localPosition = new Vector3(-6,-2,2);
sword.transform.localRotation = Quaternion.Euler(0,90,0);
}
After a certain amount of time the sword is in the player's hand. The animations are done in blender. I just want to attach the sword to the player's arm after the animation has reached a certain point.
if(animation[attack.name].time>0.4*animation[attack.name].length && attacking == 1)
{
sword.parent = swordarm;
sword.transform.localPosition = new Vector3(-3.5f,0.8f,-1);
sword.transform.localRotation = Quaternion.Euler(80,45,225);
}
The problem is that the localRotation and localPosition are not changing.
↧