Scale_along_z : why?

First off, I’ve used Defold for multiple 2D games and really love it. I appreciate all the work that goes into it.

Is your feature request related to a problem? Please describe (REQUIRED):

I spent an entire day confused as to why my 3D positioning code wasn’t working. After checking the forums here for similar problems, I saw the mention of a “scale_along_z” value that I had never seen nor heard of before. From what I can tell, this value:

  • Doesn’t appear in the IDE, you can only find it by opening the collection file in a text editor
  • Is undocumented
  • Defaults to zero, which distorts the z scaling on positioning (in my specific case, z values were 1/3 x and y for the same relative distance in 3D space)

I changed the value to 1 and things finally started working.

I’m absolutely baffled by this. It cost me a day of code because it’s so random and undocumented that I can’t see any way to figure out what’s going on without reading through forum posts. I would highly recommend doing something about this. If nothing else, change the default to 1.

4 Likes

Yes, it’s an old technical debt that we have been meaning to fix for a while now.
It’s quite unfortunate that we’ve ended up “in between” solutions currently.

We have a ticket to fix this, and we should try to do so this summer (we plan to have a cleanup of old breaking changes):

3 Likes

edit: sniped with the same reply.

Maybe Defold should have a 3D manual that mentions this, at least until this summer? Are there any other 3D quirks that would need to be documented? I’ll write it if y’all have any suggestions as to the content.

1 Like

Thank you!

Thanks for this @ckastensTG - I had been doing some horrible stuff in my data to resolve this.
Note: all collection files need to have scale_along_z set to 1 for it to work.
Ive been trying to get my f18 game ready for release, this also killed about 4 days of mucking around.
Note: This has been an open issue since 2016 :slight_smile: (see other forum posts).
Probably at least expose it in the editor would be valuable, and some docs - one line in set_scale or something.

3 Likes

I think I wrote this already in issues on GitHub and in Discord - I believe the team should have added ‘scale along z’ as a toggle to the collection. That’s it. A very simple solution.

Instead, so many devs and even me, when I forget about it, fall into the trap of looking for bugs in their projects where there are none.

When the team comes up with a good replacement for ‘scale along z’, it will have to be announced ‘deprecated’ anyway and everyone will have to be warned. Because we already have to use this toggle even if it is hidden.

5 Likes

I’m going to start this task next week: Remove Scale Along Z property in collections · Issue #9529 · defold/defold · GitHub

8 Likes

Is this a flag specifically for 2D rendering?
If so, cant you just have a “mode” for a collection? Ie.. its a 3D collection or its a 2D collection.
Having it hidden I dont think helps anything mainly because of it kinda largish impact on 3D scenes :slight_smile:
Oddly, I didnt have this issue when building the counterstrike 3D scenes, so Im not sure why that worked fine and Im only now seeing it in the f18 game? I didnt see it in the 3D scenario builder tool at the end of last year either, so is there something new in Defold versions that make this more required maybe?

Id almost think too (not sure if it makes sense) if you need a flag for 2D flattening, that it would actually be activated in editor depending on the 2D/3D setting, and then in the project depending on a project setting? (or as mentioned at a collection level). Dunno.