I have a sword in a game. When you click on the sword, it deletes and creates another one in your hand. It does this correctly but with a random rotation. How do I fix this?
#pragma strict
var hand : GameObject;
var sword : Transform;
function OnMouseUp()
{
Destroy(gameObject);
var clone = Instantiate(sword, hand.transform.position, Quaternion.identity);
clone.transform.parent = hand.transform;
Debug.Log("The Sword is in your Inventory");
WaitForSeconds(1);
}
↧