is transform.forward rounded off?

Hi there,

I’m using transform.forward to get the direction an object is facing. When I Log out the value I get xyz with 1 decimal place. eg

(0.1, 0.3, 1.0)

Is it actually more accurate than this? I’m get some issues when I multiply it and I’m wondering if this might be the problem. For example, when I rotate the object a bit I would expect the value to go to

(0.1, 0.3555, 0.9555)

but it jumps straight to

(0.1, 0.4, 0.9)

Hope that makes sense. I’m really tired.

Thanks
Bill

The logging will be truncating the precision, try adding this:

Debug.Log(transform.forward.ToString("F2"));

F2 means “format the string to 2 decimal places” etc.

yes, and you can also see more exact value by printing them separately vec.x, vec.y, vec.z

they are floating point values, so there is always going to be some inaccuracy thanks to that… just something to bear in mind when working with vectors.

excellent. Thanks very much.