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$
0

1 Answer 1

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$
5
  • $\begingroup$ Thanks for the answer, and, what if I'm getting 0.0006? $\endgroup$
    – blackhole
    Commented Jan 6, 2016 at 4:05
  • $\begingroup$ In that case I would like to see your demo file. $\endgroup$
    – Monster
    Commented Jan 6, 2016 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
    Commented Jan 7, 2016 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
    Commented Jan 7, 2016 at 6:03
  • $\begingroup$ Ah. I thought it was something else as it always rotates to the same extent. Thanks ;) $\endgroup$
    – blackhole
    Commented Jan 8, 2016 at 1:50

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .