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 HeliosJack · Aug 15, 2013 at 10:47 PM · animationrotationparentingparent-childskeleton

Rotation problems when I child a sword to players hand! (pictures within to clarify)

First, observe this image of the shoulder rotating correctly. It rotates properly along the joint, but the sword doesn't stay in his hand, because it is not a child of the hand:

alt text

now, I child the sword to the hand, so now the shoulder should rotate and the sword should stay in the hand, right? Not quite:

alt text

now for some reason, the shoulder pivots around the sword instead of the chest!

What's going on!?

correct rotation.png (114.2 kB)
bad rotation.png (135.7 kB)
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

Answer by zombience · Aug 16, 2013 at 03:44 PM

The sword is being interpreted as part of your bone structure, and so interfering with your animations.

I've had this problem in the past, and I've worked around it by doing this:

Make an empty game object. Make the sword a child of that object, and orient it so that the hilt is at the "center" of the empty object.

On the empty object, place a script that updates its location like so:

 public Transform target;
 
 
 
 void Update()
 {
     transform.position = target.position;
 }


then drop the transform of the hand onto the "target" variable in the inspector for this game object. The game object will now lock to position wherever the hand is. you can adjust the location of the sword by moving it around in local space, relative to the parent object.

if you want it to follow rotation, you can add the line:

transform.rotation = target.rotation;

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

16 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

Related Questions

2d: Animating a child's transform will lock the Parent in place 0 Answers

How can I stop a parented object from resetting its transform when a parent animation play? 1 Answer

How do I rotate my parent object without rotating the child object? 0 Answers

FBX import from blender rotation slightly off 2 Answers

I am trying to make a gun recoil with an animation and in this script it only runs after the first mouse click. This is probably an easy fix I just can't seem to wrap my head around it. This is my script. 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