How do we equip Armor ?

Sangemdoko

Moderator
Staff member
Yes, I am interested in your character and your equipment. So if you could make a minimalis scene with just the character and the problematic equipment that would be great.
You can right-click your asset folder and press export package.
As I mentioned previously make sure to test the package before you send it, to make sure there aren't any compilation errors or depedencies missing.
 
i sent an Email with a link to my one drive with the Exported package. Please let me know if you are able to download it or If i needed to make a smaller one and send it by another method.

thanks
 

Sangemdoko

Moderator
Staff member
Thank you very much for sending your project. I was able to identify the problem.
The issue was that the equipment root node does not match the master root node.
I made the wrong assumption that the root node would always be the same, but doing more research I found that it isn't allways the case.

It was quite a troublesome bug to fix but your project really helped me test it out. So again thank you for the sending us your project.

Now the Equipper keeps reference of the master root node and all the character bones.
Then when a new skinned mesh equipment is added i scan all the character bones to see if I can find the matching ones by name.
I remove the equipment bone hierachy to cleanup the hiearchy since they aren't used and then link the equipment to the character bones.

Note that now the items are still pooled but they are pooled specific to a character, meaning different characters won't be able to share pooled items. That's to avoid bugs with linked bone hierarchies.

Specific to your game, you'll need to remake the Helmet and Chest Armor prefabs. The Helmet has issues with its bounds, and the chest armor is missing a material. Remaking them from scratch should be easier than trying to fix them.
Additionally you can remove the Rigidbody from the equipment.

Please find the new Equipper and ItemObjectSlot scripts attached.

I hope that with those changes you won't have any more problems with equipping items.
 

Attachments

  • Equipper.cs
    28.8 KB · Views: 1
  • ItemObjectSlot.cs
    4.3 KB · Views: 1
Thank you, I really appreciate you taking the time to review this and get back to me so quickly. I am glad this has helped you to identify the issue and hope this will other out in the future. The remake of those prefabs is not an issue. thanks again.
 
Hi, there is something strange happening with the Wrist pads, I have done the exact same as I did with all the other items, which they work part from this one.

Its not removing the "Root" like it does with all of the other Armor Pieces.



1632914415062.png

1632914466572.png

1632914571546.png
 

Sangemdoko

Moderator
Staff member
Thank you for letting me know. I made a small change just after sending you the script thinking it wouldn't change anything, but turns out it fixes the issue you came accross.
Please find the new Equipper attached... Hopefully that's the one that will work perfetly.
1632915364907.png

Last side note. The warning you are getting says you have two or more gameobjects in your bone hierarchy that have the same name. In your case you need to rename one of the two game objects called "Item" within your character bone hierarchy. For example you can rename them "left Item" & "right Item".
 

Attachments

  • Equipper.cs
    28 KB · Views: 1

Sangemdoko

Moderator
Staff member
Yes,
In your case it shouldn't affect anything since those are never used as bone weights for your equipment.
But the system I wrote uses the bone names to find matching names (There's no better way apparently) so having unique names within your bone hierachy is important. That's why I added this warning
 
Top