Flicking with 3d skeleton animation

If T-pose substantially different than animation pose. It flickers before each new iteration.
Problem was found when animation was set to default animation, but reporoduciable also when animation set from scrip.

I reproted this on Github https://github.com/defold/defold/issues/6427
But probably someone knew wokeround or it is something wrong with my approach.

We had this problem too a while back. It seems like the first frame, after having been looped, is reset to its base pose.

We patched this by looping manually and starting on frame 2 after the first animation has played.


Could you please advice how to start from second frame?

The way we did it was:

  1. Manually assign frames to each animation.
  2. Use the model.play_anim() callback to trigger the next animation with an offset based on the number of frames.

Here is the rough and ready module that might help:

local M = {}

	["idle"] = 61,
	["reveal_intro"] = 31,
	["reveal_intro_random"] = 90,
	["reveal_waiting_loop"] = 31,
	["reveal_jump"] = 61,
	["reveal_end_loop"] = 61,
	["ui_select"] = 30,
	["ui_celebration"] = 45,
	["inside_cannon"] = 91,
	["flying_fast"] = 16,
	["flying_slow"] = 16,
	["swinging"] = 16,
	["scared"] = 16,
	["collision"] = 8,
	["rolling"] = 4,
	["celebration"] = 4,

local FPS = 60

local function get_offset(anim_id)

	local frame_count = ANIMATIONS_FRAME_COUNT[anim_id]
	local offset = 1/frame_count
	return offset


function M.play_anim(url, anim_id, loop, blend_duration, cb)

	local playback_rate = 1
	local offset = get_offset(anim_id)

	model.play_anim(url, anim_id, go.PLAYBACK_ONCE_FORWARD, {playback_rate=playback_rate, blend_duration=blend_duration, offset=offset}, function()
		if loop then
			M.play_anim(url, anim_id, loop, blend_duration)
			if cb then


return M

The main downside of this is that the frames of each animation has to be defined manually. We couldn’t find a way around this, because there is no way to get the total frame count from a model at runtime (or at least there wasn’t when we implemented this!).


@totebo wow, I didn’t expect that you share your module!
Good job :heart_eyes:.
It works perfectly for me.
I hope it will be fixed on engine level =)

p. s. I spent weekend to try solve it. I am not have expirence with Defold and honesly with animation in Belnder not so much also. So, I thought problem with me =)


Here’s a simple solution to this problem via Blender: https://github.com/defold/defold/issues/6427#issuecomment-1230681279
And you don’t need any extra LUA-modules.