We use cookies to ensure that we give you the best experience on our website. If you continue to use this site we will assume that you are happy with it.

Strange variable and procedure behaviour

Home Forums Puzzles Strange variable and procedure behaviour

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #42437

    Hi there,

    I’m struggling with a wired variable behavior. This is bed configurator. There is a studio scene and 2 .gltf scenes (bed 160cm and bed 200cm). Primarly it loads .gltf with 160cm bed and swaps with 200cm bed if button (html) is triggered. Here is a scenario how it works right now:
    1. Main scene is loaded and appended with SLF24_bed_160.gltf
    2. It sets few variables (for now just focus on hdb_type variable – hdb_type=0)
    3. It checks what is the state of this variable and if it’s equal to the initial value it calls procedure “show_button_headboard” (there are 5 headboard types). So far so good.
    4. When I click on a button with id=”size_200″ it unloads currently imported .gltf and loads SLF24_bed_200.gltf
    5. Then it rechecks all variables (intact!) and calls procedures accordingly to variable values.
    6. but… if I press button with id=”size_200″ again (or “size_160” if 160cm .gltf is currently loaded) all headboard unhides just like all procedures were called simultaneously.

    It doesn’t happen if I switch between 160 and 200 .gltf’s. Only If I trigger a button “size_200” when gltf with 200cm bed is loaded or “size_160” when gltf with 160cm bed is loaded.
    It looks like procedure definition executes itself without even calling it.
    What’s wrong?

    All the best,
    Krzysztof.

    Attachments:
    You must be logged in to view attached files.
    #42440

    OK, never mind. I figured it out. I created another variable that stores information about which scene is currently loaded. Then I check value of that variable (with “IF”) before executing load/unload function so if scene is loaded the algorithm prevents from loading the same .gltf again (which was causing the issue). :)
    Damn, it’s so easy only with puzzles and a bit of brain :)

    #42452

    glad you worked it out! :good:

    Chief 3D Verger | LinkedIn | Twitter

Viewing 3 posts - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.