Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 Jun 22
sparklines
Close Help
  • 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
0
Question by Daphnis26 · Aug 30, 2013 at 06:18 PM · animationmodelparentweapon

Weapons for 3D character

Hey, I'm getting ready to add weapons (guns) to my character and am wondering what the best way to go about this is. I've done searches and looked at examples trying to find out how best to set this up.

It's not for an FPS, so the animations are important. I'm using Maya, and not the Unity animation/rigging.

So the easiest way I can think of is to model a weapon into my character model, and then switch out the material (from invisible to texture) when the weapon is selected. I will only have a few weapons in the game so this might work. Still this seams like a really stupid way to do it.

I have tried to parent objects to my character in Unity but can't get them to animate with the character. Is this because I'm using an external application to create my animations?

What would be the ideal workflow for adding weapons to a character in Unity? Thanks!

Comment
Add comment · Show 3
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 Daphnis26 · Aug 30, 2013 at 07:40 PM 0
Share

Would working with the Unity animation tool provide more options and features in Unity?

avatar image CG-DJ · Aug 30, 2013 at 08:06 PM 1
Share

Working with $$anonymous$$echanim will definitely help with transitioning between animations. There is a lot you can do with $$anonymous$$echanim that you can't do with the normal animation system. However, it will not help with attaching a weapon to your rig.

Here are some good resources on mechanim: Link1 Link2

avatar image Daphnis26 · Aug 30, 2013 at 08:21 PM 0
Share

Very cool, thank you.

2 Replies

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

Answer by CG-DJ · Aug 30, 2013 at 08:03 PM

Hello,

Yeah, making invisible textures for weapons is definitely not the way to do it. Make the weapons as individual models and then parent the model to the bone you want the sword to follow. When I make animations like this in Blender, I add a special hold bone just in front of the palm, where I want the handle of the sword to be. Then I import the sword into the project in Blender, attach the sword to the bone, and make my animations. Then, when I export to Unity, I only export the character, not the weapon. Then, when I attach the weapon to the bone in Unity, the animations behave just like they do in Blender. The same basic idea should work in Maya.

Now, depending on the different weapons you have depends on how many animations you need to make. For example, if you have multiple swords, try to make it so that the same attack animations will work for each sword. If you have different types of weapons (i.e. axes, maces) then you probably (but maybe not) will want different animations for each weapon type. However, you may not have to make different idle animations for each weapon type, since you can basically hold a sword, ax, or mace the same way.

Now to switch between weapons, I'm a little at a loss there. I have never had to do that, but I'm sure someone else can help you. However, I know there is an easy way to do it. It may be just instantiating the weapon at that spot every time you switch weapons, or it could be you have all the weapons attached to the bone, but you have them disabled until you need them. I don't know.

Good luck with your game! (and be sure to vote up if it helps)

Comment
Add comment · Show 6 · 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 Daphnis26 · Aug 30, 2013 at 08:20 PM 0
Share

Awesome, parenting the object to the bone is exactly what I needed to do!

Now to switch weapons, yeah I'm back to the invisible texture or enable/disable object idea.

I'm sure there must be a better way to do this. Will continue to read up on this now that I've got the parenting working.

avatar image CG-DJ · Aug 30, 2013 at 08:29 PM 0
Share

I'm 99% sure invisible textures is a bad idea. If no one else comments in the next few hours, ask a new question specifically about weapon switching.

Although, before you do that, make sure you do a thorough google search, looking for things like "unity mmo weapon switching" or "unity weapons switch"

avatar image Daphnis26 · Aug 30, 2013 at 09:24 PM 0
Share

I agree. I think the only downside to invisible texture would be the extra performance hit of all the hidden objects. $$anonymous$$y character is pretty small on the screen so a few hidden low poly objects may not be too bad in this case.

I know it's not optimal, just gotta find a legit way to do it.

avatar image Daphnis26 · Aug 30, 2013 at 09:25 PM 0
Share

I'm pretty sure I could spawn the object (with a specific rotation) as a child of the bone, and then remove it...

avatar image Vonni · Aug 30, 2013 at 09:37 PM 2
Share

$$anonymous$$ake the weapon have a local position of 0,0,0 position and rotation. Instantiate it, parent it, move to pivot (bone), set its transform to zero. OR. Even better would be to have them lying around somewhere hidden in a pool, and swap them back and forth from there. Depends on the situation.

Show more comments
avatar image
0

Answer by dannidam · May 14, 2015 at 02:02 PM

as far as i know if you don't have a attach bone from Blender or Maya, you can also attach GameObject"mount".. to you character in unity this way you can also control the attachment, and it should follow your animation. - although i think that you need to attach it in Blender/Maya also to make proper animations..

Comment
Add comment · 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

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.

Follow this Question

Answers Answers and Comments

20 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

How i can setup Character 0 Answers

MMD How to export model and animations to Unity as 3rd person controller? 2 Answers

Make mesh collider constantly change 1 Answer

Can I import animations from multiple model files in an assetBundle? 0 Answers

Scale animation with model 1 Answer


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