Sie sind nicht angemeldet.

1

Sonntag, 6. August 2023, 19:28

Get previous scene_name

Hey All.
I wanna to create, store and get previous scene_name using global variable.
Do you guys think its working or any other way better?

Dieser Beitrag wurde bereits 1 mal editiert, zuletzt von »jack bauer« (6. August 2023, 19:43)


Tuur

Erleuchteter

Beiträge: 3 839

Wohnort: Netherlands

Beruf: Krpano custom coding / Virtual Tours / Photography / Musician / Recording engineer

  • Nachricht senden

2

Sonntag, 6. August 2023, 20:35

Hi,

Write the current scene name/index to a custom current scene variable, and transport that to a custom previous scene variable on the onnewscene event and set a new 'current scene'..

Like

Quellcode

1
<event name="prevscene" keep="true" onnewscene="if(notfirstscene, prev_scene = cur_scene; cur_scene = xml.scene;, notfirstscene = true; cur_scene = xml.scene;);" />

Then only in the first scene there is no previous scene.. which you could set manually or make some button invisible or so..
.. or something like that.. *wacko*

Hope it helps,
Tuur *thumbsup*

3

Sonntag, 6. August 2023, 21:15

Actually my question is not clear yet. I'm wanna make a feature explore 3d space button like matterport, when click on dollhouse then click on explore 3d space it going to prev scene except dollhouse and floorplan scene. I think my problem solved now.
In onload function i'm create global variable prevScene and assign to default scene then whenever i'm loading to new scene i updating prevScene variable = new scene if new scene is not dollhouse or floorplan scene.
And in onclick explore 3d space i'm calling load scene and pass prevScene as a parameter.