Animate Y coord

i use rendercam and this code for X axis animation standart 2d coord to 3d
all animation build with panthera

	local node_body = global_.go_robots[message.uid].body.s2
	
	local node_body_position = go.get(node_body, "position")
	local sc = rendercam.world_to_screen(node_body_position, false, false)
	
	sc.x = sc.x + 15  -- **+ 15px to right**
	local wd = rendercam.screen_to_world_2d(sc.x, sc.y, false, sc.z, false)

	go.animate(node_body, POSITION_X, go.PLAYBACK_ONCE_FORWARD, wd.x, gui.EASING_OUTSINE, 1 / speed)

Seems to work correctly both forward and backward.
But if I try Animate Y coord - GO always move down (((

	local node_body_position = go.get(node_body, "position")
	local sc = rendercam.world_to_screen(node_body_position, false, false)
	sc.y = sc.y + 5 -- **even if I subtract or add**
	local wd = rendercam.screen_to_world_2d(sc.x, sc.y, false, sc.z, false)

	go.animate(node_body, POSITION_Y, go.PLAYBACK_ONCE_FORWARD, wd.y, gui.EASING_OUTSINE, 0.25 / speed, 0, function()
        end)

Hello! Can you provide more information and examples?

For the code you provided all should work correctly, don’t see any issues here

Thanks for answer ))

I make this

and get this code for body - head and legs is a childs of body

go.animate(node_body, POSITION_X, go.PLAYBACK_ONCE_FORWARD, node_body_position.x + 15, gui.EASING_OUTSINE, 1 / speed)

but i use rendercam

and work normal only this code for body

	go.animate(node_body, POSITION_X, go.PLAYBACK_ONCE_FORWARD, node_body_position.x + (direction and 15 or -15) / 15, gui.EASING_OUTSINE, 1 / speed)

	go.animate(node_body, POSITION_Y, go.PLAYBACK_ONCE_FORWARD, node_body_position.y + 5 / 20, gui.EASING_OUTSINE, 0.25 / speed, 0, function()
		go.animate(node_body, POSITION_Y, go.PLAYBACK_ONCE_FORWARD, node_body_position.y, gui.EASING_OUTSINE, 0.25 / speed)
	end)

all works fine, but i use divider / 15 for x and / 20 for y coords. Else all fly away ((
I think this is due to incorrect calculation of the z and y coordinates of the perspective.
Perhaps you know a solution to the problem?

1 Like

I can only a guess that’s wrong, since I don’t have a full context. It’s definitely not relative to rendercam or Defold engine. Something in your node setup or animation usage, please revise all thing slowly.

Is animation started correctly and you don’t start the animation every frame?

How these bodies are fly away? these dividers are strange way to fix this btw

Is parent for animation nodes flipped? It can cause wrong direction of some animations inside

everything works correctly. Just in the 3d world + 20px on the Y axis != + 20 px for 2d (((