Components don't inherent z distance? (SOLVED)

Children components follow parent Game Objects relative to other factors but don’t follow them relative to z? Should it be relative like other values are?

Can you describe how to repro this? I did a simple animation on the parent z value, with the script:

function init(self)
	go.animate(".", "position.z", go.PLAYBACK_LOOP_PINGPONG, 1.0, go.EASING_LINEAR, 1.0)
end
function update(self, dt)
	print("parent: " .. go.get_world_position().z)
	print("child: " .. go.get_world_position(go.get_id("child")).z)
end

Got:

DEBUG:SCRIPT: parent: 0
DEBUG:SCRIPT: child: 0
DEBUG:SCRIPT: parent: 0.033333331346512
DEBUG:SCRIPT: child: 0.033333331346512
DEBUG:SCRIPT: parent: 0.066666662693024
DEBUG:SCRIPT: child: 0.066666662693024
DEBUG:SCRIPT: parent: 0.10000000149012
DEBUG:SCRIPT: child: 0.10000000149012

Just tried to reproduce and couldn’t so must have been something I was doing wrong earlier.

1 Like

I reproduced the same issue only with GO and Sprite component.
When you have Z in editor for sprite, you can change Z for GO this does not change sprite Z.
When I use dynamic Z (depend on Y and X) sprite Z should be 0

1 Like

Could you explain this a bit? I put a sprite on the child in my previous example, animate the parent with z outside the clipping frustum and the sprite blinks when I run it (going in and out of the visible frustum).

1 Like

Yes, you are fully right.
It’s just a problem of understanding.
I checked it twice in my own example - all fine.

1 Like