object handle in structure doesn't work with 3D functions
-
ouch. That's a good one.
-
I do not have this problem, but I use mostly objects that I’ve loaded from 3D models that is. I don’t have any dynamically created objects inside structs, only outside them. But I do rotate and move these loaded objects whose handle I’ve placed inside structs. Just some extra info to help you guys narrow down the bug.
-
@Jongjungbu If you store the handle (provided by placeObject) in a "classic" variable rather than in a field of a structure it works.
-
Hmm.. I have written this exact same code out and had no error, just rotating the cube as expected.
Can anyone else reproduce this?
-
@Dave Just checking Dave are you on the release or the patch?
-
Release. I did double check!
-
@Dave Sorry for doubting!
-
@pianofire You were very right to ask!!
-
I just replaced my NPCs with cubes in my WIP demo and no issue...
-
@pico8-jihem Hate to be this guy dude but would you mind double checking your code again? I've written it out exactly as you wrote here with no issue.
-
You're welcome. You can find the screen captures below...
http://codyssea.com/downloads/f4ns/20190904-001.jpg -- works (without struct)
http://codyssea.com/downloads/f4ns/20190904-002.jpg -- fails (with struct)
http://codyssea.com/downloads/f4ns/20190904-003.jpg -- the error message -
Is "handle" a valid struct type?
-
It is a valid type. The code he posted in the original post is slightly different than the screenshots.
The original post will work but the screencaps don’t, from my own testing. It appears to be an issue with making multidimensional arrays of structures.
So if you take lvl[7][7] and simply shrink it to lvl[7] then it works. That extra dimension from what I see is where it is breaking.
So it’s not that it doesn’t work outright per the topic title, as I use a single array of structures that I pass around for objects.
-
@Jongjungbu You are right. With a dimension, it works. If you replace "handle obj" with "int obj" in the struct block, it works with lvl [7] [7] ...
Thank you for your help. I hope it will work as expected sooner or later with a patch.I agree, this seems to be more related to array of structures than 3D functions.
-
This got very confusing very quickly. The problem being two fold.
The array type has a known bug - especially with multiple dimension arrays
The second being FUZE is very loosely typed - and populating typed vars with other values seems to cause unexpected results!We will look into this. Thanks for pointing it out @pico8-jihem and thanks to everyone else for investigating/ helping.
-
Gotta give @pico8-jihem props for pushing the envelope. Better to find these issues out sooner than later 😄