Sie sind nicht angemeldet.

1

Samstag, 30. Mai 2009, 15:35

How to set different view directions in a tour?

I'd like to set the view direction for a pano depending on which pano the user comes from. For example, if a user is in pano A and clicks to see pano B, they arrive in pano B looking in one direction. But if they are in pano C and click to see pano B they arrive in pano B looking in a different direction.

This sort of thing seems fairly important for creating cross-linked tours. I tried using a variable to set a specific pan parameter in the onclick() part of a hostpost and then using that variable as the first part of the lookto() instructions in an action - but this gives me a black pano. Peeking into the options plugin display shows that lookat is NaN/NaN (not a number)... so I'm obviously messing this up completely! :-)

(I must admit that I'm guessing wildly about how to use variables - that's not helping!)

Can anyone offer any advice?

Keith

Zephyr

Profi

Beiträge: 1 003

Wohnort: Netherlands

Beruf: Web developer

  • Nachricht senden

2

Samstag, 30. Mai 2009, 17:49

The best way to solve this is to add some parameter to your loadpano action in the hotspot. In other words:

Quellcode

1
onclick="loadpano(nextpano.xml, view.lookat(180.8,1.9,22), MERGE, BLEND(1))"

replace the values in lookat to your coordinates, where you want to lookat.

documentation loadpano

3

Samstag, 30. Mai 2009, 21:10

Sounds brilliant, and SO much simpler than the process I was trying!
The only problem seems to be... that it doesn't work for me. here's my onclick line:

Quellcode

1
onclick="loadpano(9.xml, view.lookat(180,-1,80), MERGE, BLEND(0.5));"  


I simply replaced the NULL with view.lookat(180,-1,80), removed the onstart item that set the initial view, and tried it out. This is what I get:

Quellcode

1
ERROR: unknown attriubate/path - view.lookat(180,-1,80)

Any suggestions very gratefully received! This seems like the ideal way forward, I just need to find out why the error happens and kill it off.

(BTW, Klaus? The error message contains a spelling mistake. "attriubate" rather than "attribute". :-)

4

Samstag, 30. Mai 2009, 21:27

Using lookat() rather than view.lookat() stops the error from popping up, but I get odd results still.

With MERGE in place the pan setting in the destination comes directly from the previous pano. With it set to NULL instead the pan is always 0, no matter what I put in lookat(). So perhaps all that does is stop the error - but not actually *work*! Hmm...

Keith

Graydon

Profi

Beiträge: 614

Wohnort: Texas

Beruf: Industrial gas turbine services.

  • Nachricht senden

5

Sonntag, 31. Mai 2009, 06:34

take a look at the example virtual tours here... http://www.krpano.com/examples/vtour/

specifically the group under "via hotspots connected panoramas"

The xml's for each are listed and accessible as well... but here's a clip of code that would do what you wanted...

Quellcode

1
onClick="set(view.fovmin,6);lookto(8.8165,-3.4802,6,smooth());loadpano(keller.xml,null,KEEPBASE|NOPREVIEW,BLEND(2), lookat(188.92,1.51,40);wait(blend);lookto(335.66,7.98,90,smooth(100,100,100)))"


specifically this part...

Quellcode

1
loadpano(keller.xml,null,KEEPBASE|NOPREVIEW,BLEND(2), lookat(188.92,1.51,40);wait(blend);lookto(335.66,7.98,90,smooth(100,100,100)))


The loadpano format is...

loadpano(xmlpath,parameters,flags,blend,onstart)

... and you must keep the "null" in place for items that you don't want to specify... so after the xmlpath, if there are no parameters, then you need to keep the null there.

Your code would look like this...

Quellcode

1
onclick="loadpano(9.xml, null, MERGE, BLEND(0.5), lookat(180,-1,80));"

6

Sonntag, 31. Mai 2009, 10:33

Hi,

sorry, the documentation is not fully up to date

you don't need to use the "onstart" parameter anymore, you can just place other commands
after the loadpano() call, they will be executed after the pano was loaded,

e.g.

Quellcode

1
onclick="loadpano(pano2.xml,null,MERGE,BLEND(1)); lookat(180,-1,80);"


but the view direction (or any other value) can be also set direct:

Quellcode

1
onclick="loadpano(pano2.xml,view.hlookat=180&view.vlookat=-1&view.fov=98,MERGE,BLEND(1));"


best regards,
Klaus

7

Dienstag, 2. Juni 2009, 23:14

Thanks for that! Setting the data directly did the trick. Fantastic stuff! :-)

Still experimenting, but: http://www.panoramaphotographer.com/spaces/westway/

Keith

8

Dienstag, 2. Mai 2017, 13:10

how to set the current view to the new pano

as the topic