Z-nudge (SOLVED)
by Eero Karvonen · in Torque 2D Beginner · 06/13/2014 (12:46 pm) · 2 replies
%o1 = Sprite(); %o1.setSceneLayer(15); %o2 = Sprite(); %o2.setSceneLayer(15); %o1.setSceneLayerDepth(0); %o2.setSceneLayerDepth(1):This is the principle I tried to use for nudging objects back and forth in my editor. What is the missing trick to make that in-layer Z-nudge really come into effect? Currently the sprites render at their initial Z-positions regardless of what their getSceneLayerDepth() gives.
#2
06/13/2014 (1:34 pm)
Thanks, Simon! That's the trick. Somehow my eye missed that part in the guide.
Associate Simon Love
The following example sorts object in layer 10 by their scenelayerdepth component.
This section in [url=https://github.com/GarageGames/Torque2D/wiki/Batch-Rendering-Guide#sorting]the Wiki[/url explains is pretty well.
Bonus tip : You can set the SceneLayer and SceneLayer depth during the object's construction
%MySprite = new Sprite(){ Scenelayer = 10; SceneLayerDepth = 0.01; };