2
$\begingroup$

I have a simple python script that tells me an objects rotation (a property reads the rotation). I have a static object with its rotation set to (0, 0, 0); however, when I load up the scene, the property reads a long decimal with a value very slightly higher than 0. This shows that the object has very little rotation. Is there a way to fix this other than changing the objects rotation with a script? In other words, keep the rotation at 0 at scene start? Thanks!

$\endgroup$
3
$\begingroup$

All terms of the orientation matrix are expressed in float values (floating point numbers). These numbers have a specific precision. This means when you calculate with them you get very small, but existing deviations from the "ideal" number.

This is especially noticeable around zero. Therefore you might print something like -0.0. This seams illogical but it means you have a number that is smaller than the precision of the formatter.

Unfortunately you did not include any further details such as what term you are reading and what the value is or what your code is.

My own investigation shows me:

<Matrix 3x3 ( 1.0000, 0.0000, 0.0000)
            ( 0.0000, 1.0000, 0.0000)
            (-0.0000, 0.0000, 1.0000)>

The [2][0] value is indeed -0, but it has no further consequences. You will not notice that in your scene.

$\endgroup$
  • $\begingroup$ Thanks for the answer, and, what if I'm getting 0.0006? $\endgroup$ – blackhole Jan 6 '16 at 4:05
  • $\begingroup$ In that case I would like to see your demo file. $\endgroup$ – Monster Jan 6 '16 at 5:13
  • $\begingroup$ Ah. I just noticed its parent is dynamic. However, the parent is directly above the ground, and is not affected by anything other than gravity. Do you think gravity would of caused the small rotation? Its always the same thing. $\endgroup$ – blackhole Jan 7 '16 at 0:48
  • $\begingroup$ Gravity is a force (0,0,-9.8). It can result in linear and angular velocity -> changes to location and orientation especially when colliding with other objects (e.g. with the ground). $\endgroup$ – Monster Jan 7 '16 at 6:03
  • $\begingroup$ Ah. I thought it was something else as it always rotates to the same extent. Thanks ;) $\endgroup$ – blackhole Jan 8 '16 at 1:50

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.