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 ziv03 · Dec 22, 2013 at 10:25 AM · rotationcolliderscale

negative scale+rotation+collider

I'm making a 2d game (unity 4.3). I'm using localscale.x = -1 to flip the character to the other side. it works fine, the problem is, when I rotate the character while the x scale is negative, the collider2D doesn't react very well. it starts to shrink for some reason.

When the scale is +1 it all works fine.

But I change the scale to -1, the sprite looks great, but the collider2D reacts strange and starts to shrink and doesn't follow the sprite correctly.

Any ideas?

Comment
Add comment · Show 8
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 ziv03 · Dec 22, 2013 at 12:26 PM 0
Share

The problem only happens when I put the negative scale to a parent gameobject of the collider.

avatar image ziv03 · Dec 24, 2013 at 03:29 PM 0
Share

Any help???

avatar image KellyThomas · Dec 24, 2013 at 03:58 PM 0
Share

why are your rotating?

avatar image ziv03 · Dec 24, 2013 at 04:51 PM 0
Share

I rotate the character head.. but I don't see how it is related to the question..

anyway, I rotate the character head and the circle collider attached to it doesn't rotate well when the character has a negative xScale

avatar image KellyThomas · Dec 24, 2013 at 05:49 PM 0
Share

Thanks, I asked for more info to see if I could reproduce it for myself.

I have been unable to trigger unexpected behaviour on the main gameobject, but things are playing up on sub-objects.

Rotations around the X and Y axes seem to skew both sprites and colliders in a manner consistent with the projection of a 3D object onto a 2D plane. Rotations around the Z axis spin the sprite (as expected) but also cause the size of the circle collider (but not transform scale or collider radius) to pulse in and out from full size to zero with a period of 90 degrees.

I don't have a solution that would work across the board but as a quick workaround: if your head sub-object is on the same physics layer as your main gameobject then maybe you could move the head's collider up to the main gameobject and then use a script to update it's center point to track the head position for each frame.

Show more comments

1 Reply

· Add your reply
  • Sort: 
avatar image
0

Answer by Psynbiotik · Jun 22, 2014 at 12:04 AM

This is the best solutions so far:

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

Other possible solutions:

  1. Remove rigid body on child object (this worked for me), rigid body is causing this issue.

  2. Disable collider before changing parent, then re-enable when done.

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

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

Related Questions

Common 2D Collider flip problem 4 Answers

How to change child's rotation whithout affecting it's scale? 1 Answer

how to scale object to fit inside a room 1 Answer

How to rotate a mesh collider? 0 Answers

Animation affects the rotation.. 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