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 kristian97 · Feb 16, 2012 at 07:17 PM · weaponattach

Weapon attach to player

Hi can anyone please tell me how i can make when player choose between weapons the weapon got attached to the hands of the player.

Do i need to make the whole character with the weapon in the modelling program or do i only need to do the arms with the weapon and then add it to the player as a child object. Or is there any way to add the weapon to the player and make the player hold the gun.

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

6 Replies

· Add your reply
  • Sort: 
avatar image
2

Answer by mpavlinsky · Feb 16, 2012 at 10:57 PM

You would need to model the weapon either with the point it should be attached to the player's hand at the origin or you would need to make a bone for the attachment point and position it relative to that. Then parent the gun to the player as Posly suggested, although you'll have to parent it to the specific bone transform it is intended to be attached to (right or left hand probably). In the case of two-handed weapons I would think you would need different sets of animations and to have some script assigned to each weapon that defines what type of weapon it is and what animation set it uses.

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
avatar image
1

Answer by Posly · Feb 16, 2012 at 08:58 PM

You can set the guns parent as the player with "transform.parent = player.transform", just make a var with player as a transform.

Comment
Add comment · Show 2 · 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 kristian97 · Feb 16, 2012 at 10:10 PM 0
Share

But that will not change the arm animation example if i are holding a gun and it works good when i change to a ak 47 it will not be good. Because the ak is two handed weapon while the pistol is one handed.

avatar image thedarcsage · Dec 24, 2016 at 09:56 AM 0
Share

I'd like to confirm that this works for me for holding a simple object that maintains the same orientation in relation to the player. Thanks!

avatar image
0

Answer by kristian97 · Feb 17, 2012 at 02:22 AM

But that will not make the hand animation be good on the gun i mean if i use a gun the hand animation have to change when you change to a ak 47.

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
avatar image
0

Answer by ronaldosilva · Feb 17, 2012 at 06:47 AM

Another way to solve this, more simply, is to you model the arms animation with the gun already attached. I mean, if you have 5 types of weapon, you should create 5 arms models with their respective weapons already attached. So when you choose a weapon, all you have to do is to reload the respective animated model model and trigger the "Fire" or the "Reload" animation points and thats it. Of course, tou can create bones and all kinds of complicated things.. Personaly I don´t know wich way has better performance or cost.

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
avatar image
0

Answer by kristian97 · Feb 17, 2012 at 10:59 AM

I thinked like this i make a player and cut of his arms and then add to the weapon its own arms That Will be attached to the player. But the problem is That egen i Will make the pickup system how Will i make the dropped weapon without arms and when you attach it it gets arms. Also a model on the ground and another when you pick it up.

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
  • 1
  • 2
  • ›

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

9 People are following this question.

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

Related Questions

Add Weapon 1 Answer

Question about network items 0 Answers

unlocking weapon (fps) 1 Answer

Detecting Input in the Start function (C#) 1 Answer

Start FPS player off with no weapon 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