I have about 30 weapons in my game. Most are axes and swords, the rest are spears. Is there a simple way to ensure that when I parent them to my model, that these weapons will align properly? I’ve been looking around on the internet as well as unity answers and still have yet to come up with a solution despite best efforts. If anyone could help I would be most grateful.
1 Answer
1For each different weapon type (assuming different weapons require different alignments), parent an empty GameObject to the weapon hand and position/rotate that empty "mount point" into the perfect alignment for that weapon. Then when you Instantiate() your weapon objects, instantiate them at the position and rotation of the mount point, then parent them to the mount point.
I know all of that at this point, but it's still not working correctly for me. Is there any way that I can pre position a weapon prefab before it is parented so that I can make things easier?
– TheEmeralDreamerbasically the same idea but put the mount at the right position and rotation on each weapon rather than the character and make the prefab with the mount game object and the weapon already a child of that, then parent the weapons position to a point on the characters hand, bascially the smae concept but you can save the position with the prefab rather than the character. Scribe
– ScribeI understand what you mean, however there is a difference seeing it in code and understanding the process. Perhaps I'm missing something but no matter how I try to code it doesn't really seem to work well.
– TheEmeralDreamerIn the editor, parent the weapon prefab to the "mount point" i mention in my answer, and set its both position and rotation to 0,0,0. Then rotate and position the mount point so the weapon is in the alignment that you want, then delete the prefab. That way, the mount point should be perfectly aligned, and you could instantiate your weapon prefabs at the position and rotation of the mount point and parent it to it.
– PrimeDerektivefinally got it working. thanks.
– TheEmeralDreamer