Strange bug with go rotation

I rotate go in init. Then i change rotation in update. Looks like rotation in init is ignored. But if i add go.get(".",“euler”), all works as excepted. My project script:scenes/game/player/player.script

function init(self)
	...
	go.set_rotation(vmath.quat_rotation_x(1.57))
end


function update(self, dt)
	...
	--COMMENT NEXT LINE. AND IT NOT WORK
	--pprint(go.get(".", "euler"))
	go.set(".","euler.z", -PLAYER.angle)
end	

Hi @d954mas,

What value does PLAYER.angle have and how does it get assigned?

Angle in degrees. Default value is zero.

I can repro the issue on my machine.

It’s a bit tricky mixing quaternions and Euler angles in defold. In your case, if I stick to using Euler angles it works as expected, e.g.:

function init(self)
    go.set(".", "euler.x", 180)
end

function update(self, dt)
    go.set(".","euler.z", 0)
end

We are currently looking into potential performance gains in how we handle Euler angles internally in the engine, hopefully we can straighten out some of the issues at the same time.

3 Likes

Thanks, i will try to use quaternions everywhere.

2 Likes