Trigger Event at HLOOKAT update from old post

  • This has been posted before, with a response from Klaus. post

    I am hoping there is an updated, or better way of accomplishing this with adjusthlookat or something. I wanted to do a daytime to nighttime to daytime transition when the user reached a certain horizontal point... ie around hlookat 0. It works fine if the user swings the pano left and back to the right, but if the user continues around and around in same direction, hlookat goes beyond 360 degree count and continues indefinitely with user persistence, thereby never reaching near the 0 value again.

    I am using cubeface hotspots that turn on/off inside the daytime scene to show/hide the nighttime scene.

    Test here... move right, then left, then right... but full rotate not work.
    test
    xml
    Ideas? Suggestions? Help? Advice? Criticism? *cool*

    Edited 2 times, last by nefar1ous (November 28, 2013 at 7:52 AM).

  • Hi! What if keep hlookat within the range - from -180 to +180?

    Try add this:

    Code
    <events name="hlookat_check" keep="true" onviewchanged="check_hlookat();"/>

    and action:

    Code
    <action name="hlookat_check" >
    if(view.hlookat GT 180, set(view.hlookat, -180););
    if(view.hlookat LT -180, set(view.hlookat, 180););
    	</action>

    Hope this helps.

    Regards,

    Alexey

  • Hi! What if keep hlookat within the range - from -180 to +180?

    Try add this:

    Code
    <events name="hlookat_check" keep="true" onviewchanged="check_hlookat();"/>

    and action:

    Code
    <action name="hlookat_check" >
    if(view.hlookat GT 180, set(view.hlookat, -180););
    if(view.hlookat LT -180, set(view.hlookat, 180););
    	</action>

    Hope this helps.

    Hey, thanks so much Alexey. That certainly works. Interesting, I thought the view.hlookat needed a workaround (adjust)and was not diretly editable. Been schooled again :)

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!