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 vandrewm · Aug 26, 2011 at 09:24 PM · matrix

Matrix4x4 getcolumn/row doesn't match it's own float array

I have an issue where the GetColumn and GetRow and even printing the matrix itself doesn't return the data that's in it's float array.

The float array is this:

 0.9999999,0,0,4.00131E-07,0,0.9999999,0,0,0,0,0.9999999,0,0,0,0,1

And the matrix/getcolumn/getrow all display data from this data set:

 1.00000    0.00000    0.00000    0.00000
 0.00000    1.00000    0.00000    0.00000
 0.00000    0.00000    1.00000    0.00000
 0.00000    0.00000    0.00000    1.00000

Here's my code:

 string f = "";
 Matrix4x4 m4 = new Matrix4x4();
 for (int i = 0; i < 16; i++){
     m4[i] = bindShapeMatrix[i]; //bindShapeMatrix[i] is a float
     f += "," + m4[i];
 }
 Debug.Log("m4:" + m4);//this returns data I didn't put in the matrix
 Debug.Log("m4c:" + m4.GetColumn(0));//this returns data I didn't put in the matrix
 Debug.Log("m4r:" + m4.GetRow(0)); //this returns data I didn't put in the matrix
 Debug.Log("floats:" + f); //This is what I should have stored in the matrix


Any idea's what I'm missing out on?

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

Answer by krdluzni · Aug 26, 2011 at 09:37 PM

All of the 0.9999999 values will round to 1.00000. Count the number of digits, and this will be clear (7 for the first, 5 for the second). Then the 4.00131E-07 is a very small value that will round to 0. It's actually 0.000000400131 (go here to learn about Scientific Notation: http://en.wikipedia.org/wiki/Scientificnotation#Enotation ). If what you want is for it to display the full value, you'll have to use custom formatting, but if it's just debug information, I wouldn't waste the effort.

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

3 People are following this question.

avatar image avatar image avatar image

Related Questions

Camera Projection Matrix - feeding back to itself results in different result 0 Answers

How can I scale the insides of a ScrollView 0 Answers

Transform camera to look from back in GL? 1 Answer

accessing inverse view matrix 1 Answer

structure of Matrix4x4 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