Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 14 Next capture
2021 2022 2023
2 captures
13 Jun 22 - 14 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
1
Question by frogsbo · Mar 13, 2014 at 01:12 PM · fliplookrotationmatrix4x4

LookRotation flipping 180 degrees through y axis

I have LookRotation to rotate some points as the move through space, and when it crosses the Y axis it rotates by 180 degrees, sometimes 120, so there is an error in the mesh.

this is the rotation code i am using:

 function rotatem ( origVerts: Vector3 ):Vector3 {
 var rotation = Quaternion.LookRotation(line(steps+0.1)-line(steps-0.1), Vector3.up);
     //rotation *=Vector3(0,1,0);
     var translation: Vector3=Vector3.zero;
     var scale = Vector3(1, 1, 1);
     var newVerts: Vector3 ;
     //var rotation = Quaternion.Euler(0, Time.time%199, 0);    
     var m = Matrix4x4.TRS(translation, rotation, scale);
 
 
         newVerts = m.MultiplyPoint(origVerts);
     
     return newVerts;
 }

alt text

fliprotation.jpg (417.8 kB)
Comment
Add comment · Show 3
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 frogsbo · Mar 13, 2014 at 02:43 PM 0
Share

i could derive each next rotation based on difference from the previous closest position, that is already rotated, but i want to derive all points from the original un-rotated points template, as it would allow me to morph between templates, and make toothpastes that transition between square, round, spirograph, etc.

avatar image robertbu · Mar 14, 2014 at 05:02 AM 1
Share

I fuzzy on what you are doing here, but as a guess I suspect that your use of a constant Vector3.up for all your LookRotations() is the root cause. That is, at some angle LookRotation() will be unable to rotate the object on the specified axis and have to some other rotation to achieve its goal. $$anonymous$$aybe you can fix your problem by using some relative axis to the points for the LookRotation() rather than a fixed global axis.

avatar image frogsbo · Mar 14, 2014 at 06:53 AM 0
Share

Sounds promising. yes that sounds like a solution... The problem goes like this: imagine i had 3d points representing a aeroplane, called plane1. normally its possible to rotate points into plane2 based on plane1 points, points plane3 from plane2, and it doesnt flip?

But my plane1 also has variations of shape like longer wings, and i want to use that in play, so i want to get all points rotations from plane1, not the last plane rotation.

If it's useful to someone, here is an illustration of the lookrotation data in detail..

flip2.jpg (278.4 kB)

1 Reply

· Add your reply
  • Sort: 
avatar image
0
Best Answer

Answer by frogsbo · Mar 14, 2014 at 06:58 PM

The answer is as RobertBu said. I have to define the LookRotation() second variable to be something relative to where it was pointing to recently... if i point the LookRotation() second variable to exactly 90'/-90 it stays completely straight, otherwise 95 degrees it goes corkscrew. If it's a square toothpase i can't control it yet, it's kindof pointing randomly depending on recent curve. A next challenge will be have straight and to control the rotation of square so that i can have some kinds of floor and walls.

many many thanks RobertBu, i love you :)

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

Flipping projection matrix problem: It flips everything but the Skybox. How do I fix this? 1 Answer

Problems with Gropuing after a scaling matrix modification.... 0 Answers

Are these rotation matrices right ? 2 Answers

export max to unity ??? 2 Answers

Script not obeying? 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