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 Andrew_Kenady · Feb 07, 2014 at 05:11 PM · transformscaleparentchildflip

Object scale/rotation changes when parented to flipped object

Hello! I'm working on a project where user drawings are added to in-game objects, and we've come across an issue with changing transform.parent on game objects.

In this instance, the code will change the parent(s) of a list player-drawn line segments to the tree visible in the following screenshot when the line collides with a canvas attached to the tree:

Tree

This works as expected. Each line is positioned to the point where the input collides with the tree's 'canvas' mesh, and each line segment is rotated to face the next line segment with Transform.LookAt. When the parent of each segment is changed to the tree, the segments maintain their respective relative world position/rotation/scale.

However, our problem comes up when the target parent object (in this case, the tree) is scaled negatively on one or more axes before attaching the children. When changing the Transform.parent property on a line segment, if the parent tree is flipped, the lines go crazy and assume some seemingly random rotation/scale (seen below).

alt text

Just to clarify, I'm not talking about scaling the parent object after the children are already assigned to it. That works perfectly fine. But when a parent object has a negative scale (in this case, the tree has a scale of (-1,1,1)) and children are attached, the children don't maintain their world rotation/scale as expected.

Why does this happen? Is there any way to circumvent it? Any help is appreciated! Thanks in advance! :)


Edit: I've confirmed, the issue is very similar to the collider issue linked in my comment below. Here's an easy way to recreate my issue:

  1. Start a new project and scene

  2. Add 2 quads to the scene

  3. Give them each a rotation of (20,20,20) (just so you can see the undesired effect)

  4. Create 2 empty gameobjects, and give the 2nd a scale of (-1,1,1)

  5. Move one quad into the first empty gameobject, and notice that the quad doesn't change shape. Move the 2nd quad into the 2nd empty gameobject, and notice that the quad rotates and scales in an unexpected way.


Edit #2: I found out what factor by which the lines are offset... Apparently when the parent is scaled negatively on X, the child needs an inverse Y and Z rotation, and the scale needs to be reset to the values before it was added to the parent. What a weird bug :/

tree2.png (40.9 kB)
tree.png (50.5 kB)
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 Andrew_Kenady · Feb 07, 2014 at 04:48 PM 0
Share

I think this issue might be closely related to this bug, which is easily reproduced.

The idea is, create a cube in a new project. Add the cube to an empty game object as a child. Change the parent object's scale to (-1,1,1). Rotate the child cube, and observe the difference between its mesh and its bounding box.

$$anonymous$$aybe it's the same bug and just interacts with quads in a different way?

0 Replies

· Add your reply
  • Sort: 

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

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

Related Questions

Make gameobject a child without affecting scale? 1 Answer

Problem with child and parent. 1 Answer

Good way to scale parent without scaling children? 1 Answer

Make a simple tree 1 Answer

undoing the process of parenting an object 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