Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 12 Next capture
2021 2022 2023
1 capture
12 Jun 22 - 12 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
2
Question by Kristian Bak · May 15, 2010 at 10:32 AM · scalemirrorflip

Mirror flip using scale -1

When using scale -1 to flip an object, the colliders are not flipped correctly. Is there any other way to flip an object?

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 Peter G · May 15, 2010 at 10:41 AM 0
Share

What kind of collider colliders are you talking about because I didn't notice anything wrong when flipping them?

3 Replies

· Add your reply
  • Sort: 
avatar image
1

Answer by johan-skold · May 15, 2010 at 04:26 PM

When flipping an object you're basically making the triangles go the other way around. I can never remember the order they're supposed to go but if they go clockwise normally, they would end up going counter-clockwise, effectively turning the mesh inside-out. A simple fix is to reverse the orders of the triangles so the mesh is turned inside-out to begin with.

using System; using UnityEngine;

public class ReverseTriangles : MonoBehaviour { public void Awake() { Mesh mesh = GetComponent<MeshCollider>().mesh; int[] triangles = mesh.triangles; Array.Reverse(triangles); mesh.triangles = triangles; } }

Note however that this makes the mesh un-stripifiable, so if you plan on combining collider meshes you cannot make a triangle strip out of them.

Edit: I might have misunderstood "not being flipped correctly" as "being broken after being flipped". If they aren't being flipped at all, that's another story.

Edit 2: I also just realized I was assuming you meant a MeshCollider. If that's not the case, I don't have a solution for you other than to put the object in question inside a parent, and giving the parent the collider instead.

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

Answer by Eric5h5 · Aug 07, 2010 at 10:21 PM

The colliders are flipped correctly when changing the scale in Unity to -1. If you're doing that in a modeling program, maybe it doesn't work; I'm not sure.

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

Answer by Matt-Downey · Dec 17, 2011 at 10:26 AM

Your problem might be solved by:

GL.SetRevertBackfacing(true);

There are still major problems with lighting (only ambient and non-realtime light will work).

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

1 Person is following this question.

avatar image

Related Questions

2d character flipping and conditionally walking backwards 0 Answers

Flip a render texture? 2 Answers

Using transform.localScale to flip object 1 Answer

Reflection upside down? Unity 3.3.0f4 (63135) 1 Answer

Object scale/rotation changes when parented to flipped object 0 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