Hi,
I’m trying to make the card flip effect with perspective camera view and took strange behaviour of labels component.
Game Object has the back sprite and several labels with card parameters.
The some labels are blinking when GO is rotating. I quess they go behind to the sprite. But the other labels are not blinking.
Code of rotate animation: go.set("hero","euler.y",-45) go.animate("hero","euler.y",go.PLAYBACK_LOOP_PINGPONG,45,go.EASING_LINEAR,5)
How it looks:
Perhaps what labels with some z-order are cutting by camera. But it’s so strange what label “def” works correct and not blinked with the same Z as other labels.
Huh, that seems a bit weird I must admit. Especially at ~1.07, when the sprite is removed and you see all labels clearly, but they still disappear/appear.
The position of the labels are offset from the game object, so when you rotate the game object, they’ll go in/out of the screen along the z axis. You can try using a larger range for your Z values (e.g. -10 to 10) in your render script.
But I agree, if “def” has the same z value as “atk”, then it’s weird.
I’m trying to create the similar animation (flip card) but using Rendercam instead. Is there any way to do this with Render cam instead of the custom render? I try to uncheck the Orthographic checkbox in Rendercam but it doesn’t seem to work!
You have to add rendercam as folder into your project and fix render script as you wish.
UPD: also, in my game I’ve removed some animation where “z-order war” bug was visible and did’t use the predicates for render layers, because some card must be over other, and this trick didn’t fit to solve the issue. Just added biggest value to z in label properties eventually.
You can use a custom render script with Rendercam, as long as you don’t change how it sets the viewport, view, and projection, and a few start-up variables. The easiest way is to copy the Rendercam one into your main folder somewhere and modify it.
Change the file extension back to “.render_script”. (I had to change it to upload to the forum.)
Make a new “Render” file to hook it up (right-click > New… > Render).
Set the “script” of the render file to the “rendercam_cards.render_script”.
Open your game.project, under bootstrap > Render, select the new Render file you made.
I just modified the way models are rendered, since it was pretty close already, so it might mess up 3D models if you are using them? I’m not an expert on this at all.
Oh, also, unfortunately you can’t just un-check “Orthographic” on your camera and have it work nicely, you need to change some other settings. To start with I recommend:
Set your camera’s Z position to 500.
Set “Near Z” to 1, “Far Z” to 1000, and “View Distance” to 500.
I did change some settings after un-check “Orthographic” like Ross suggested, but it wasn’t working. That is because I didn’t change it to such large number as he said, and now it seems to work!
I also got into the “z-order war”, I will try again using the method Dragosha suggested tomorrow, hopefully everything will work as expected!
Again, thanks all for the responses. I read a lot about how Defold has a smaller community but the quality is much better than others, now I now it’s all true!
Bumping this because the “z order war” of labels is still a problem. Labels need a setting where each glyph can have a unique z position, or maybe offset them per character back and forth by a tiny bit (as a setting) so that they don’t z fight when used in 3d space.