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
0
Question by aniol006 · Jul 15, 2021 at 05:12 PM · rotationquaternionparent-childmatrix4x4

Different results with Matrix4x4.MultiplyPoint and Matrix4x4.rotation

Hello,

I have a GameObject GO1 representing a Camera with four spheres (s1_1, s1_2, s1_3, s1_3) as children. Then I have another GameObject GO2 with four more spheres (s2_1, s2_2, s2_3 , s2_4) as children. The GO1 and GO2 have slightly different positions and rotations. Similar, the spheres of GO1 and GO2 also slightly different distributed.

I calculate the rotation and translation matrix ( Matrix4x4) to move the spheres of GO2 (s2_1, s2_2, s2_3 , s2_4) to get as close as possible to the respective spheres of GO_1 (s1_1, s1_2, s1_3, s1_3). Then I use the Matrix4x4.MultiplyPoint with each sphere. This works fine.

However, I would like to just rotate and move GO2 and not each single sphere using the matrix that I calculated. To do so, I use Matrix4x4.rotation and I multiply it with the transform.rotation of GO2. I thought that I should get the same result but it doesn't. Does anyone have an idea on how to rotate GO2 using the rotation matrix? If I use Matrix4x4.MultiplyPoint with GO2 it just changes the position but not its rotation and thus the children are not rotated accordingly.

Thanks!

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 andrew-lukasik · Jul 15, 2021 at 09:32 PM 0
Share

Do you mean transform.rotation = matrix.rotation ?


Matrix4x4.MultiplyPoint

Performs full transformation of a vector (so scale, rotation and translation)

matrix4x4.rotation

Extracts a rotation component from a 4x4 matrix. Returns a Quaternion.
avatar image aniol006 andrew-lukasik · Jul 16, 2021 at 08:27 AM 0
Share

I have tried transform.rotation = matrix.rotation and transform.rotation *= matrix.rotation but both give wrong results.

avatar image andrew-lukasik aniol006 · Jul 16, 2021 at 08:56 AM 0
Share

I can try to help but you need to show some code here. It's hard to guess anything more from your description as it is now.

0 Replies

· Add your reply
  • Sort: 

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

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

Rotation of child object is different in play mode 0 Answers

Creating a Matrix4x4 from an Object's Transform 1 Answer

Quaternions applied to Sensor Fusion: gyro.attitude with compass 1 Answer

How To Rotate a two point around main circle?? 1 Answer

Rotate relative to Parent 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