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
0
Question by Nazahaam · Oct 17, 2017 at 03:01 PM · vectormatrixgeometry

Change Global cartesian system vectors

Hello everyone,

I'm working on a visualization tool in which I use Unity to show some result from an external physics engine. The problem is that this physics engine is not using the same cartesian system as Unity, meaning that I have to convert every data incoming from the external physics engine. I would like to know if instead of convert all incoming data, I could change the Global cartesian system directly in the setting of Unity, for exemple if I could change the direction of "x" vector so that the frame respect the right-hand rule ?

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
1
Best Answer

Answer by Bunny83 · Oct 17, 2017 at 03:45 PM

No. The whole Unity engine is based on a left handed system. So manually changing for example the camera matrix which is responsible for the world to camera space conversion it would mess up things like frustum culling.

The easiest solution is to setup a transformation matrix which does the desired conversion. So just multiply your incoming data with that matrix to get the proper coordinates in Unity.

Note that a left to right hand or right to left hand conversion does not only need a position conversion but if meshes are involved you also need to reverse the winding order of each triangle.

Normally if you just want to switch between left and right hand system you would just multiply the z value by "-1" as in almost all systems x and y are the same but z is different. The "normal" matematical system uses the same x and y as Unity but has a z that is pointing towards the camera, not away from it.

What kind of "data" do you talk about?

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 elenzil · Oct 17, 2017 at 06:08 PM 0
Share

you also need to reverse the winding order of each triangle

in some situations you can also skip reversing the winding and ins$$anonymous$$d reverse the culling mode from cull-back-facing to cull-front-facing. i'm not actually sure if that's an option w/ unity cameras tho.

avatar image Bunny83 elenzil · Oct 19, 2017 at 04:32 AM 1
Share

Well, Unity doesn't have a global setting to define what's a front and what's a back face and which one gets culled. So as far as i know in Unity CW (clockwise) triangles are generally considered "front faces" and CCW (counter clockwise) triangles are backfaces.

The actual culling mode depends on the used shader. So if you use just a few shaders where you have the source available you can simply swap the culling mode. $$anonymous$$ost shaders cull backfaces by default. A few don't cull at all. If you set the cullingmode to "front", only backfaces would be rendered.

avatar image Nazahaam · Oct 18, 2017 at 08:38 AM 1
Share

What kind of "data" do you talk about?

$$anonymous$$ostly position, speed and acceleration vectors, so I guess i'll have to convert everything. Thanks for the advice on transformation matrix. Anyway I think I'll do the conversion before sending them to Unity.

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

73 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 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 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 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

How to avoid changing transform.parent? 2 Answers

Why Matrix4x4.MultiplyPoint does row-major access while Matrix4x4 is column-major? 1 Answer

How is a gameobject rotated when you set it's forward? 0 Answers

How to find perpendicular line in 2D? 3 Answers

Is there such a thing as Unity Algebra? 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