Home Game Development unity – How to divide a Vector3 to get better a scale issue?

unity – How to divide a Vector3 to get better a scale issue?

0
unity – How to divide a Vector3 to get better a scale issue?

[ad_1]

Fun reality: there are solely 4 attainable division algebras over the reals:

Any different division algebra have to be isomorphic to one in every of these, by the Frobenius theorem.

Note that 3-vectors usually are not within the record! There is not any full and constant option to outline division over third-dimensional vectors. In reality, William Rowan Hamilton was trying for a option to divide triples when he found quaternions.

So, vector division is just not a helpful manner to consider this drawback.

If your scale is just ever uniform, then you have got the identical worth in all three elements x, y, and z, so you may simply choose one:

float dimension = remodel.localScale.x;

If you may have non-uniform scale, then to digest three doubtlessly completely different scale components down into one, you want some option to common them, both taking their arithmetic imply:

float averageSize = (remodel.localScale.x 
                   + remodel.localScale.y
                   + remodel.localScale.z) / 3f;

Or their geometric imply:

float volumeScale = remodel.localScale.x 
                  * remodel.localScale.y
                  * remodel.localScale.z;

float averageScale = Mathf.Pow(volumeScale, 1f/3f);

[ad_2]

LEAVE A REPLY

Please enter your comment!
Please enter your name here