Change Starting View with custom URL

Hello there!, Is there a way I could set the starting view from my view list by changing the URL?

For example if I have 3 different designs in each view, could I use a #view1, #view2 or #view3 at the end of my URL to set the where my scene starts with?

I am aware we could do something like this by using our own server/ code. But is there a way to do this with our scenes stored in the Shapespark cloud?

Thank you so much!

Jorge.

1 Like

You can append a #view=<VIEW-NAME> hash to the URL to start the scene in the given view. See Room names in top and orbit views for more information.

3 Likes

Thanks for the response, it works awesome, another question would be as follows.

Is there a way to hide or show objects using code, independent of the views?

What we want to do is try to have One scene on our server and create 3 unique URLs out of it, where we show three different designs inside the same scene, each design would have the same set of views, ex. Exterior, Living Room, Bedroom. So changing between the views would always show the objects we told Shapespark to show for that URL hiding the other two. Is there any documentation for a Show or Hide function?

@Multitaskr_Capital

Hope I made sense. Thanks!

Yes, it’s possible, please take a look at this post: Hiding Object from html - #2 by wojtek

2 Likes

Oh my, I wish I would have known this earlier haha. Very good to know, thanks for the info.

1 Like

Is it possible to specify the view in a meeting also? I want to assign a used a seat position linked to a view. I have tried appending the meeting url, but appears it invalidates it

Join the URL options with & character instead of #, for example: 3D scene starts the scene in the Kitchen view and shows the help pop-up.

1 Like

I have a similar question; Will this URL link also work within an HTML Label to change the view? Something like this:

I thought I’d set it up but when I click the view doesn’t change, but it does append #Breakout-Area to the URL.

Thanks

The link to needs to end with #view=Breakout%20Area not #Breakout-Area
%20 encodes a space that is present in the view name.

Got it, works perfectly! Thanks for that :clap:

Hello @jan and @wojtek ,

In the documentation, it’s shown that we can get user’s world co-ordinates. It’s also shown that we can create custom view position by using these co-ordinates.

However, I want to ask if it’s possible to use these co-ordinates and pass it in the url, so that when user enters next time, he can begin from the same spot he previously had left ?

In short, can I ask if it’s possible to append the URL or add a JS code which starts the scene from a custom view name which is a variable.

Thank you.

Shapespark doesn’t support such arguments, but if you are asking about some custom solution, you can add any hash arguments in the URL and then handle them in your javascript code, for example you can add:

Then using javascript window.location.hash property you can parse these extra arguments jquery - How can you check for a #hash in a URL using JavaScript? - Stack Overflow and pass them to the switchToView function.

Wonderful. I just want to understand how the URL should look like.

For example, I want to pass X, Y, Z as well as Pitch and yaw degree. So will the URL look like this

or something else ?

These values are completely transparent to Shapespark, so you can pass them in any format and with any names that you prefer.

Hello,

Choosing scenes with #view= is not possible with meetings?

It is possible, like for example in this meeting link: https://demo.shapespark.com/flat-for-a-couple/#view=Bedroom&meeting-key=yUrVp4TVfPTLlHP6

(In this case URL uses two arguments: view and meeting-key, such arguments need to be connected with &, having two arguments that start with # is not supported by browsers).