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 Euchenor · Sep 05, 2014 at 09:55 AM · scaleparentchild

Preserving children when irregularly scaling parent

I'm trying to modify the scale of a player at runtime, but not uniformly, e.g., edit his height but not width or breadth. Now I want his firearm to remain unchanged, but this isn't happening.

To the player skeleton I added an empty "palm" gameobject to set the base firearm position, and the firearm model has an empty gameobject parent as a base with a uniform scale of 1. At runtime, the firearm base is parented to the palm object.

I am seeing two issues. One, the firearm does not appear to be preserving its scale when I set its parent, and two, more importantly, the firearm disintegrates and its different parts move in different ways.

Is there a way to solve this?

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 Owen-Reynolds · Sep 05, 2014 at 02:05 PM

Use hand-coded fake parenting. Keep just an empty on the hand, where the gun should be, to let Unity track it for you. Don't child the gun, to avoid inheriting a crazy scale. Instead, in Update:

 gun.position = gunEmpty.position;
 gun.rotation = gunEmpty.rotation;

The problem with real parenting and non-uniform scale+rotation isn't that it's buggy, but that it works properly. The gun distorted along those odd axis is the real math (scaling the player on world-Y scales the gun on world-Y.)

Then, if you want the gun to scale with the player, you can hand-scale the unchilded gun (which will use it's local axises, and look good.)

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 Euchenor · Sep 05, 2014 at 02:45 PM 0
Share

Thank you for your suggestion. Actually, I did try that, seeing it on another post about the topic, but using this method does not seem to update fast enough, as the gun lags a little. Do you have an idea to solve that?

avatar image Owen-Reynolds · Sep 07, 2014 at 02:32 AM 0
Share

Partly lies in knowing the exact sequence in which unity runs things. If the arms are set by an animation, the place to add "now that animation is finished" is in LateUpdate().

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

3 People are following this question.

avatar image avatar image avatar image

Related Questions

Make a simple tree 1 Answer

make a child always have its own scale? 7 Answers

Make gameobject a child without affecting scale? 1 Answer

How can I Instantiate a clone as a child of another object, and inherit the parent object's scale? 2 Answers

Problem with child and parent. 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