I am conscious that in Unity, while you wish to add (e.g.) a weapon to a personality, you guardian it to the “hand” bone of the character and so forth…
Effectively I am making an attempt so as to add a hat to a personality in unity when it is clicked (and the top of the character is shifting round beforehand), and I need the hat to at all times be in the identical place on the characters head, it doesn’t matter what place the (animated) head occurs to be in when it is clicked.
I attempted making a reference mesh in blender (only a dice), after which setting the hat mesh to the identical place of that mesh in unity, and to do this I attempted parenting it to the top bone after which positioning it on the precise spot of the top within the blender mannequin, however I did this through the use of the “Baby Of” restraints and apparently blender restraints do not render to unity.
SO I am unsure if making a reference merchandise in blender was the proper answer, however how can I set the place of the hat to the identical place on the characters head?
EDIT:
I am utilizing a fundamental CharacterController for the character, and principally my character begins as a capsule object with the CharacterController after which I conceal the capsule mesh and make my .fbx mannequin a toddler of the capsule, and when shifting I solely rotate the mannequin, not the capsule (if that is related), however I (additionally) need to have the ability to place objects on NPCs which can be shifting round, and up to now the way in which I am making these is simply including a capsule collider to the .fbx and including click on occasions to it with occasion triggers… anyhow here is the the node construction of the NPC mannequin if that helps:
the “teffilinBox” is the placeholder that I manually added after it imported to Unity, and it is what I used to be making an attempt to get mechanically by parenting with Blender, which did not work.
BTW, I discovered one other approach to make meshes kids of bones in blender, by going into pose mode and manually parenting the mesh to the bone, which WORKS in blener and it APPEARS to work in unity, though; the issue:
In blender, while you guardian to a bone, it does not truly guardian to the bone itself, it simply weights it 100%, and it is truly a toddler of the armature solely, with 100% weighting, so after I import it to unity, it does not acknowledge the parent-child relationship in any respect, nevertheless it nonetheless strikes with the top so I suppose it acknowledges the weighting…
After I tried to make the hat object a toddler of the placeholder, it wasn’t affected by the top in any respect, since in unity the placeholder itself is not an precise youngster of the top, it simply appears to be like that means. And after I tried to guardian the hat to the top, then simply modify the world place to that of the dice, it was at all times means off.
SO I simply discovered a workaround that works, in case anybody else is having this drawback: in Blender, when making the placeholder, simply transfer to the primary body of the animation and place it however DON’T guardian it to something, then give it some distinctive identify like “placeholder_Head” after which in Unity, on one of many begin features, discover that gameobject (or ALL of the sport objects that begin with “placeholder” after which extract the opposite a part of the identify with Regex or one thing) and THEN guardian it to the right bone, in unity script, and afterwards, you may connect the hat object as a toddler of THAT, since now the placeholder is an actual youngster of the bone. That labored for me, if anybody is aware of of how else to do it, I wish to know 🙂 ‘trigger the primary drawback with this technique is I am unsure how one can programmatically add all the placeholders as kids to the respective bone, as a result of you may’t simply get a gameobject identify with regex (Discovering Recreation Object with Common Expressions), with out actually looping by all the gameobjects or one thing like that… So does anybody know one other means to do that (fairly fundamental) factor?
PS: to attempt to duplicate my challenge to see what I imply, simply get a rigged character in blender and attempt to make a placeholder dice or one thing then choose the armature, go to pose mode and choose the dice and shift-select the precise bone you wish to guardian it to, then make the animation and see the way it strikes with the bone in blender, however then import it to unity and take a look at setting one other object to the kid of the placeholder with script any localPosition at 0, you will see it does not work in any respect.



