Greetings!
I wanted to check if Unity has any support for attaching one mesh to another. I'd like to be able to attach say a gun to a character's hand or put something on the characters back, etc. I've seen vague references to a parenting system, but not many details
Parenting is the easiest way to do it. Your code might be something as simple as:
var hand : Transform;
function Update () {
if(Input.GetButtonDown("Fire2")) {
transform.parent = hand;
//Attaches the gun to the hand.
transform.position = Vector3.zero;
transform.rotation = Quaternion.identity;
//Since position and rotation are in local space, this will place
//the gun on the hand joint facing forward. You can offset it as well
}
}
This just sets the gun to the player's hand and then you do not have to worry about attaching it every frame.