Animating the euler.z does not work properly when used in update (DEF-1636) (SOLVED)

I stumbled across a weird behaviour while using rotations.

When i put this simple line in the init-function, the object is rotated smoothly as it should:

go.animate(".", “euler.z”, go.PLAYBACK_LOOP_FORWARD, 360, go.EASING_LINEAR, 2.0)

But as soon as i put the same line into my update-function, the animation stops when reaching 90° instead of going the full circle. I thought it would be canceled and then restarted with each update-call which should cause no such problems. Or am i’m wrong here?

To make things even more strange try this:

  • Put the line back into the init-function
  • Put a simple angle = go.get(".",“euler.z”) into your update-function

Now the animation behaves totally crazy. It again stops at 90° but this time the gameobject also flickers around very strangely. I have no explanation why simply reading the euler.z property during update results in breaking the animation.

I’ll now call this a schroedingers rotation. As soon as you look at it, it changes it’s value :wink:

There’s an issue in our backlog for this: DEF-1636

Printing go.get(".", “euler”) will show that there is flipping going on using euler.x and euler.y for certain angles (which I think explains the unexpected results when manipulating only euler.z)

Solved in Defold 1.2.123

@britzl you’re having a good day today!

3 Likes

Yeah, extremely satisfying to to add those (SOLVED) tags to posts! And especially rewarding when it’s that damn pesky euler issue we’ve lived with for quite some time.

7 Likes