• Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
1
Question by TheEmeralDreamer · Sep 09, 2011 at 08:07 PM · parentweapon

Weapon Parenting v.3.0

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.

Comment
Add comment
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

1 Reply

· Add your reply
  • Sort: 
avatar image
0
Best Answer

Answer by PrimeDerektive · Sep 09, 2011 at 08:35 PM

For 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.

Comment
Add comment · Show 5 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image TheEmeralDreamer · Sep 09, 2011 at 10:17 PM 0
Share

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?

avatar image Scribe · Sep 09, 2011 at 10:25 PM 0
Share

basically 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

avatar image TheEmeralDreamer · Sep 09, 2011 at 11:32 PM 0
Share

I 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.

avatar image PrimeDerektive · Sep 09, 2011 at 11:56 PM 0
Share

In 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.

avatar image TheEmeralDreamer · Sep 10, 2011 at 06:42 AM 0
Share

finally got it working. thanks.

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Welcome to Unity Answers

If you’re new to Unity Answers, please check our User Guide to help you navigate through our website and refer to our FAQ for more information.

Before posting, make sure to check out our Knowledge Base for commonly asked Unity questions.

Check our Moderator Guidelines if you’re a new moderator and want to work together in an effort to improve Unity Answers and support our users.

Follow this Question

Answers Answers and Comments

4 People are following this question.

avatar image avatar image avatar image avatar image

Related Questions

Instantiate New Gun 1 Answer

How do I parent a weapon to my character? 1 Answer

Is there a way to make a selected object a child of another object during the game? 1 Answer

Delay child objects rotation 0 Answers

Weapons for 3D character 2 Answers


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges