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 aitchest-of-dees · Oct 20, 2014 at 11:14 PM · gameobjectscaleboxcollidermirror

Mirroring a game object with children without messing up box colliders

I have a fairly complex object made out of cubes and I want to create a mirrored copy of it. I am attempting to do this by setting the scale to -1 on the x of the transform for the mirrored version of the object. Unfortunately, due to the nature of the object (many children rotated and positioned around in different ways) the box colliders get messed up. They are sitting at the wrong angles after flipping on the x. Is there a way in script to correctly mirror a game object without messing up the colliders?

colliders ok:

colliders ok

colliders goofed after mirror:

colliders wrong

colliders ok.png (8.3 kB)
colliders wrong.png (6.9 kB)
Comment
Add comment · Show 4
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 mwbranna · Oct 20, 2014 at 11:31 PM 0
Share

Why can't you copy the whole parent object and rotate the whole thing 180 degrees around the y axis?

avatar image aitchest-of-dees · Oct 20, 2014 at 11:45 PM 0
Share

That wouldn't be a mirror image, it would be rotated and all the children would be at the same angles as the original. I need all the angles flipped so left becomes right.

avatar image mwbranna · Oct 20, 2014 at 11:50 PM 0
Share

Rotating the parent by 180 degrees will flip the angles of the children, as long as they are angled with respect to the parent... try it out.

avatar image aitchest-of-dees · Oct 20, 2014 at 11:55 PM 0
Share

It isn't the same. Compare the angles of this image to the 2nd image I posted:

wrong angles

rotation is no.png (11.8 kB)

2 Replies

· Add your reply
  • Sort: 
avatar image
0

Answer by alexander11 · Oct 21, 2014 at 12:05 AM

this may help

http://answers.unity3d.com/questions/581430/how-to-properly-flip-2d-character-with-new-unity43.html

Comment
Add comment · Show 3 · 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 aitchest-of-dees · Oct 21, 2014 at 12:11 AM 0
Share

This is a collection of game objects with rigidbodies. They are also 3D, not 2D. The post you linked mentions "none of this works with rigidbodies" and advises people to stick with 3D, which is what I'm doing, but rotate 180 degrees, which is not a mirror image.

avatar image mwbranna · Oct 21, 2014 at 01:06 AM 0
Share

Even in this link it says the cleanest solution is to rotate the entire system by 180 degrees around the y axis to "mirror" it. That is your solution.

avatar image aitchest-of-dees · Oct 21, 2014 at 01:14 AM 0
Share

I guess I'm confused then. What does "rotate the entire system" mean, and how does one do it?

avatar image
0

Answer by aitchest-of-dees · Oct 30, 2014 at 12:13 AM

In case anyone runs into this, here's an answer, though I really hope it isn't the answer. I ran with my interpretation of what mwbranna said "rotating the entire system", though in actuality it ended up being "rotate the negative y angle of every child object and position each object at the negative x position, having put all the objects into a separate list before doing any of this because the whole child-parent relationship will mess things up otherwise". That's the short version of the answer, anyone looking for more can check out a video demonstration of the problem and my solution here: https://www.youtube.com/watch?v=qtq5nY04V4g&feature=youtu.be

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

4 People are following this question.

avatar image avatar image avatar image avatar image

Related Questions

GameObject's scale gets 0 after being parented in editor 1 Answer

Can the insides of a gameObject affect its transform? 0 Answers

GameObject Scale as World Coordinates (Units)? 1 Answer

How do I permanently resize a model with children? 2 Answers

Whats the difference between transform.localScale.Set(2,1,1) and transfrom.localScale = new Vector3(2,1,1) 2 Answers


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