Newby needs help: define actions for hotspots

Kala
Posts: 2
Joined: Mon Feb 05, 2018 4:42 pm

Newby needs help: define actions for hotspots

Postby Kala » Mon Feb 05, 2018 4:57 pm

Hello everybody
i'm absolutely not a developer, so i'm sorry if I ask some absolute basic stuff. I have some problem to set up everything. I was able to set up a scene with one 360° picture and to create a hotspot with the help of the editor. But now - obviously - I wanted to link some actions with this hotspot like showing a normal picture in a smaler frame or going to a next 360° image (as for a virtual tour). As I understand I need to define a seperate action and link this action with the hotspor, right?
so set up would be:

Code: Select all

{"story":
{"scenes":[{...
"hotspots": [{"uid", "material", "events"}]}]},
{actions": {"uid", "target"}}


is this correct? if yes: what actions can I define? Is there any list or something like that? Or what would be actions to open a small normal picture in a small frame or to go to a next 360° picture/a next scene?
if no: what did I understand wrong?

Thanks for any help!

User avatar
rroux
ForgeJS Team
Posts: 166
Joined: Wed Oct 26, 2016 12:19 pm

Re: Newby needs help: define actions for hotspots

Postby rroux » Tue Feb 06, 2018 2:08 pm

Hello Kala,

Welcome to the ForgeJS forum!
You should take a look at this sample: http://forgejs.org/samples/hotspots-with-actions

At the bottom of the configuration you'll find actions declaration.
Just take a simple action like this one :

  1. "actions":
  2. [
  3.     {
  4.         "uid": "action-loadscene-0",
  5.         "target": "viewer.story",
  6.  
  7.         "method":
  8.         {
  9.             "name": "loadScene",
  10.             "args": ["scene-0"]
  11.         }
  12.     }
  13. ]


This action will call the loadScene method of the viewer.story object and pass it the uid "scene-0" as an argument.
So, if you have a scene with the uid "scene-0" this scene will load when this action is triggered.

To bind an action to an hotspot you just have to add the action to the hotspot event "onClick" like this :

  1. "hotspots":
  2. [
  3.     {
  4.         "uid": "hotspot-0",
  5.         "transform": { ... },
  6.         "geometry": { ... },
  7.         "material": { ... },
  8.  
  9.          "events":
  10.          {
  11.               "onClick": ["action-loadscene-0"]
  12.          }
  13.     }
  14. ]


Don't forget to try the action sample.
Hope this helps !
- Raphaël

Kala
Posts: 2
Joined: Mon Feb 05, 2018 4:42 pm

Re: Newby needs help: define actions for hotspots

Postby Kala » Wed Feb 07, 2018 11:53 am

Hello Raphaël
Thank you very much for your help! It works :D I even manage it to implement the hotspot DOM examples (that's one small step for a developer, one giant leap for me ;) ).
Thanks again and great tool!

User avatar
rroux
ForgeJS Team
Posts: 166
Joined: Wed Oct 26, 2016 12:19 pm

Re: Newby needs help: define actions for hotspots

Postby rroux » Fri Feb 09, 2018 12:39 pm

Hey that is very cool ! I'm very happy to help !
Do not hesitate to share you creations in the forum in the showcase section.
Have a nice day
- Raphaël

Evarot
Posts: 13
Joined: Sat Jan 27, 2018 4:34 pm
Contact:

-

Postby Evarot » Sun Jun 26, 2022 8:04 pm

I need to make my shout box only visable on my forum and not the portal because we do not want guests to see it. Can Anyone help me with that?

Who is online

Users browsing this forum: No registered users and 1 guest