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 /
This post has been wikified, any user with enough reputation can edit it.
avatar image
0
Question by VictoryX · Jun 15, 2012 at 06:03 AM · animationweaponcustomoffsetlightwave

Custom Weapon Animation

So I created a custom weapon inside of Lightwave, assigned bones, weight maps, animated it, saved the scene, and exported it as a .FBX file. I bring it into Unity and it appears to work fine. If I set the animation to loop and drag the weapon onto the floor of my level and let it go it plays great. So now I attach it to my character and add some code so the animation plays on left mouse click. When I click however, the animation plays but all the pieces of my weapon get thrown out of whack. I was wondering if anyone has experienced this or may know the issue. Below is a link to a video showing the problem as well as the code being used. If more information is needed please let me know and I will try to give as many details as possible.

Video Link: http://www.youtube.com/watch?v=byGtZxerKlU

Comment
Add comment · Show 1
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 fafase · Jun 15, 2012 at 06:08 AM 1
Share

Have you tried to attach the boxing box as a child of the player. Then just try it with an if(Input) to see if it goes fine. I mean without scripting.

2 Replies

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

Answer by Grady · Jun 15, 2012 at 06:38 AM

Hey! Just sort of an elaboration to @fafase. What I would do, is make your boxing glove box a child object of the camera. Once it is, position it so that it looks like it's in the right position from the first person view. Then just make sure that you're animation is attached to the box game object, and make sure the animation is not on loop.

Then just add a simple script to it like this:

 function Update(){
     if(Input.GetButtonDown("Fire1"){
         animation.Play("yourAnimation");
     }
 }

Then just change yourAnimation to whatever the name of the animation for the box is! Once again, remember to make sure you have the animation attached to the box!

I hope this solves your problem, as I'm sure it's that script you already have on there that is causing the trouble for you!

If this doesn't help, then post back and I will see what I can do!

-Grady

Comment
Add comment · Show 4 · 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 VictoryX · Jun 15, 2012 at 06:57 AM 0
Share

I parented the Boxing Glove Box to the camera and added the script to the boxing glove with the code you gave. It still has all the pieces of my weapon flipping out in different directions.

avatar image fafase · Jun 15, 2012 at 07:13 AM 0
Share

I would get back in the animation window and start it again.

avatar image VictoryX · Jun 15, 2012 at 07:20 AM 0
Share

It's working now. It was importing wrong because I didn't set up the model in it's normal relaxed state inside of $$anonymous$$odeler, I just modeled it and set it up inside Layout. What you need to do is set up inside modeler as it will look and orient on the 1st frame f animation. Then in Layout animate from that point forward. Also I created a Null object and parented my model and rig to that. Not sure if that helped or not but it didn't hurt. Thank you so much for your help!

avatar image Grady · Jun 15, 2012 at 07:29 AM 0
Share

that's good! I'm glad you fixed your problem!

avatar image
0

Answer by VictoryX · Jun 15, 2012 at 10:02 AM

I parented the Boxing Glove Box to the camera and added the script to the boxing glove with the code you gave. It still has all the pieces of my weapon flipping out in different directions.

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

5 People are following this question.

avatar image avatar image avatar image avatar image avatar image

Related Questions

3rd person gta like weapon problem?? 0 Answers

Prevent combat animation reset to its actual offset? Help? 1 Answer

Best way to Animate with models that interact with other models? 0 Answers

Legacy animation with custom 1st keyframe value 1 Answer

FPS Weapon and animation 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