#Transform.right unexpected result

1 messages · Page 1 of 1 (latest)

heady osprey
#

I'm having a small issue with Unity Transform:

#

This is the game window, I am hovering over the smaller subPart

#

The code that tells me the side I have selected:

float fwdBack = Vector3.Dot(target.transform.root.forward, hit.normal); // Z
            float rightLeft = Vector3.Dot(target.transform.root.right, hit.normal); // X
            float upDown = Vector3.Dot(target.transform.root.up, hit.normal);       // Y
#

This works perfectly for the bigger part, but the smaller one has an issue where transform.right returns a value -1.192093E-07

#

Not sure what to make of this or how to find a solution

rotund mist
#

(that number is essentially zero)

heady osprey
#

Yeah, but what if the Dot product returns -2.2853E-10

rotund mist
#

Then they're orthogonal

#

For all intents and purposes

heady osprey
#

Ahh, so I should treat that as a 0 then

rotund mist
#

0.0000000002285...

heady osprey
#

Ahh, no i did not 😅

rotund mist
#

Scientific notation

heady osprey
#

I read that as "really big number" tbh

#

Whenever I see an E in a number

rotund mist
#

Pay attention to the exponent 😉

#

Negative exponent means small