You are not logged in.

Dear visitor, welcome to krpano.com Forum. If this is your first visit here, please read the Help. It explains in detail how this page works. To use all features of this page, you should consider registering. Please use the registration form, to register here or read more information about the registration process. If you are already registered, please login here.

1

Thursday, July 12th 2012, 11:09am

Why is the onviewchange event disabled ?

Hi,

I've implemented a compas on my VT ; the code is inspired from the "compass" included in the KRPano examples.

I use the "onviewchange" event to update the compass heading,

It works fine in most cases, except during "moveto" and "movetohotspot" actions ;

I've tried setting "nonblocking" to true in the moveto actions, but it didn't change anything...

Any suggestions ?

Thanks for your help

Philippe

Zephyr

Professional

Posts: 994

Location: Netherlands

Occupation: Web developer

  • Send private message

2

Thursday, July 12th 2012, 11:45am

I dont know about the onviewchange being disabled, but non blocking parameter is only for lookto function.
3d childrens game using krpano Game
Minify your xml with my krpano XML Compressor
Krpano XML Parsing Error Checklist
Available for hire (krpano xml, javascript, actionscript, flash, php and ipad plugins).

3

Friday, July 13th 2012, 8:41am

Yes, I know that, so I've tried using the lookto non blocking funtion, but it does'nt seem to change anything...

4

Friday, July 13th 2012, 8:46am

oops, in my initial post I mentionned "moveto" and "movetohotspot" actions. Its a misprint *sad* , I meant "lookto" and "looktohotspot" instead ; and the only one of these with a non blocking parameter is "lookto".

But anyway, the problem is still there, and I have no explanation yet...

Zephyr

Professional

Posts: 994

Location: Netherlands

Occupation: Web developer

  • Send private message

5

Friday, July 13th 2012, 9:54am

try downloading the newest krpano.swf and/or try an older version. Make an example with just the onviewchange event

Source code

1
2
3
4
<krpano onstart="showlog(); moveto(90,0);" >
<events onviewchange="trace(view.hlookat)" />
<preview type="grid()" />
</krpano>
3d childrens game using krpano Game
Minify your xml with my krpano XML Compressor
Krpano XML Parsing Error Checklist
Available for hire (krpano xml, javascript, actionscript, flash, php and ipad plugins).

6

Friday, July 13th 2012, 10:26am

I think I'm slowly going somewhere :

Source code

1
lookto(x,y,field,smooth(100,100,100))
is blocking so that view.hlookat is not updated until lookto is done

Source code

1
2
lookto(x,y,field,smooth(100,100,100),true,true);
nextaction();
is nonblocking : view.hlookat is updated while lookto is running.

However, in this case, since it is nonblocking, nextaction() is executed while the lookto is running, so that it's a mess. I've tried :

Source code

1
 lookto(x,y,field,smooth(100,100,100),true,true,WAIT)
to wait for the end of the lookto action but it doesn't work.

right now the only solution I have is :

Source code

1
2
lookto(x,y,field,smooth(100,100,100),true,true); 
delayedcall(2.0,nextaction());

but that's really not satisfying, because I don't know what the delay must be : it depends on how long the lookto action could last, and that is unknown.

What I nead is some way to wait until the lookto action is ended.

Right now I've no idea how to do this *confused*

7

Friday, July 13th 2012, 10:48am

I've found the answer ; its so simple I feel stupid about it *cry* :

Of course, the "donecall" of the nonblocking lookto is called when the action is .... done !

So that the answer is

Source code

1
lookto(x,y,field,smooth(100,100,100),true,true,nextaction());

and this works perfectly : nextaction() is run only when lookto is finished, and view.hlookat is updated since lookto is now nonblocking.

Now I whish there was a nonblocking looktohotspot ; well I'll have to rewrite the code anyway, so...

Thanks for your stimulating help, Zephyr

Philippe

Zephyr

Professional

Posts: 994

Location: Netherlands

Occupation: Web developer

  • Send private message

8

Friday, July 13th 2012, 12:59pm

I sometime throw in a delayedcall(0, doaction()); when actions start to soon.

about the looktohotspot:

%1 = hotspot name
%2 = field of view

Source code

1
2
3
<action name="lookto_hotspot">
lookto(get(hotspot[%1].ath),get(hotspot[%1].atv), %2,smooth(100,100,100),true,true,nextaction());
</action>


or differently you add a third parameter with the nextaction() in it or have the nextaction as property in the hotspot.
3d childrens game using krpano Game
Minify your xml with my krpano XML Compressor
Krpano XML Parsing Error Checklist
Available for hire (krpano xml, javascript, actionscript, flash, php and ipad plugins).