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 gump74 · Aug 20, 2013 at 05:39 AM · rotationjavascriptblenderparenting

I am having an issue with the rotation of a child

Greetings all, I am having an issue with the positio of a child. To start off with my main model was made in blender, I have two bones parented to the hand. One is at the bottom pointing up, the other is at the top facing down. The being with the thumb pointing vertical. I have a knife with a bone in the middle. When I was working in blender parenting the knife bone to the bladeup bone it would assume the postion of the parent bone and it would also assume the rotation of the bone. The same is true for the bladedn bone. The blade of the knife should point up if attached to the bladeup bone and down if attached to the bladedn bone. One thing of note; for some reason all of my blender meshes need a -90 rotation on the x axis - this is not a big deal and it is easily adjusted, I just wanted to put it out there. When I parent the bone of the knife to either bone in the hand the rotation is way off, also it seems to be parented to the top of the hand bone not the base of it. The rotation does not change with being parented to either bone it is pretty must the same with a minor difference in position. So far I have tried alot of different lines of code and most of them produce crazy results, the two hat are the most stable are:

 transform.parent = up.transform;
 transform.position = up.position;
 transform.rotation = up.rotation;

and

 transform.parent = up.transform;
 transform.localPosition = Vector3(0, 0, 0);
 transform.localEulerAngles = new Vector3(-90, 0, 0);

up and dn are script Transforms. I use javascript. I am wondering should I be using the local rotation on the up bone? is that even possible? or am I just way off?

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 gump74 · Aug 22, 2013 at 02:04 AM 0
Share

I have also tried setting

 transform.localPosition = up.localPosition;
 transform.localRotation = up.localRotation;

and that is close to the right position and looks like the right rotation but it is not in his hand.

1 Reply

· Add your reply
  • Sort: 
avatar image
0

Answer by gump74 · Aug 22, 2013 at 03:23 AM

ok through random troubleshooting I was able to resolve the issue. One I had to go into blender and change the roll of the knife bone so that it was pointing away from the roll of the bone in the hand. this must be a bug in unity. then the following code puts it in the right position and the right rotation.

 transform.localPosition = Vector3(0, 0, 0);
 transform.localRotation = up.localRotation;

and that fixed it.

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

15 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

Related Questions

A node in a childnode? 1 Answer

How to change the pivot point of a mesh in script? 1 Answer

Disabling the Z axis? 1 Answer

[SOLVED]Possible Alternation of Transform.Rotate 1 Answer

Debug states its true but if doesnt trigger. 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