Hello Unity3D i have a question about how to make a character hold a weapon.Does anyone know how to make to them hold something like a sword or a book or a cup?If so can someone tell me how?
In code or in the scene view…
In code you set the transform.parent of the object to the hand/position transform of the character.
In the scene view drop your item onto the hand/position transform of the character.
You may have to adjust the position and rotation of the object and even setup an empty parent for it so that this adjustment is stored in it’s prefab.
To do this well it is a good idea to setup the hold points in your modelling software as empty/null points than can be named and will follow the animation of the character.
Inverse Kinimatics. Use pro’s IK if you can, or you can use this if you have Unity Free: https://www.assetstore.unity3d.com/#/content/1829. Or program it yourself, and get some use out of trigonometry.
Basically, IK lets you rotate the joints of a character such that they get a tip joint (usually a hand or a foot) as close to a target as it can without stretching.
Haven’t tried this yet but it looks promising: