I have an odd problem with Unity.
I got a Swords Prefab and a Character with a sheath on the back. The sheath has a bone where the sword should be.
Now i parent the Instantiated Sword Object to the Sheath bone, which works just fine (i think?!). Now i have to Rotate the sword for 90degrees so that it fits perfectly in the sheath. But i cant change the rotation or position of the sword in the script. I`ve tried localPosition, position, rotation, localRotation, eulerAngles, localEulerAngles, nothing works.
I can rotate the sword in the scene - view though.
The sword model was imported from blender…is it important wich pivot i use there? Or could something different went wrong there?
Here is the important part of the script:
public Transform Swords;
public Transform rightSheath;
void Awake ()
{
Transform swordR = (Transform)Instantiate(Swords, rightSheath.transform.position, rightSheath.transform.rotation);
swordR.transform.parent = rightSheath;
movement.direction = transform.TransformDirection (Vector3.forward);
controller = GetComponent<CharacterController>();
Spawn ();
}