Hey,
I need to parent an object to another via scripting. I am using Unity iPhone and JavaScript. I've been using the following code in the Start() function.
*transform.parent = hand;
transform.localRotation = hand.localRotation;
transform.localPosition = hand.localPosition;*
This is working. However, my object (a gun model) that I'm wanting to parent to the hand is still offset a bit from the hand instead of being positioned directly to the location of the hand. In my 3D app, I have set the pivot for the gun model so that it's right at the handle of the gun. I would think that by setting the localPostion and localRotation of the gun to the hand, the gun object would be positioned exactly at the hand.
I can't figure out why there would be an offset. I'd greatly appreciate any help.
Thanks,
Wes