- Home /
attaching armor to bone in proper position !!! help!
var chestarmor : Transform; var chest : Transform; function Update () {
if (Input.GetKey ("e")){ chestarmor.transform.parent = chest.transform; chestarmor.transform.position = chest.transform.position; chestarmor.transform.rotation = chest.transform.rotation;
chestarmor.localRotation.x = 3.26; chestarmor.localRotation.y = -88.95; chestarmor.localRotation.z = -87.51; chestarmor.localPosition = Vector3(-1.54,0.031,2.7); // Set local position so that hat sits on top of the head. } }
this is my equip item script.. yet it wont attatch properly and im currently stumped
Answer by $$anonymous$$ · Jan 11, 2012 at 12:22 AM
still need help on this!. just need to figure out how to attatch a gameobject directly centered on another gameobject!
too much weirdness for setting position to center here...
why do you set armor position/rotation to the other objects position/rotation and then right after that start screwing with the position/rotation again with odd-ball numbers? .... if it's made to fit properly, then just child the armor to the other transform and set it's pos/rot to match it. ...if the armor isn't made to fit properly, then I'd re-make it.
Answer by TenshiYuna · Feb 06, 2013 at 09:56 PM
Easiest thing to do is child the new object to the reference, for example, make the hat object a child of the head object and then make the hat object have 0,0,0 position and 0,0,0 rotation. However, this depends on the pivot of the actual object. Here is a good example http://www.youtube.com/watch?v=M4MCvI5DT3k
Your answer
Follow this Question
Related Questions
How to bind two gameobjects together? 2 Answers
Problem with ragdolls and my armatures 3 Answers
How can You Attach GUI text *above* a certain object? 2 Answers