Trigger event at hlookat="XX"

  • Hi,

    directly triggering an event when reaching a specific point isn't possible, but you can use the onviewchange event and do there specific checks...

    e.g. here a a one-time check if hlookat is greater then 90:

    Code
    <events name="viewtest" onviewchange="if(view.hlookat GT 90,  events.removearrayitem(viewtest); trace(...do your stuff here...); );"  />


    one-time because after the condition is the first time true, the event itself will be removed and the custom code executed (the trace in this example),

    if an event should trigger constantly when reaching a certain range, it would be more complicated - an additional variable, that stores if inside or outside the range, must be used,

    e.g. this code checks when entering the hlookat range 90-180 and when leaving it:

    best regards,
    Klaus

  • Hi Klaus,
    I have been browsing the forums looking for an option like this to fix a problem. I too need a way to call an action when the user passing a certain viewpoint in the tour. The problem with this "continuous code version" is when the user passes the point, and continues spinning the tour in the same direction, the view.hlookat value continues to build towards infinity (so long as the user continues moving one direction). So the point in the scene we need a trigger, is gone.

    I have a daytime/nighttime transition using 1 scene. Then i have 6 cubeface hotspots in the scene. So the scene starts as day, then switches to night, back and forth. I have yet to figure a code that will allow for continues transition at a heading say 0-1 degrees (view.hlookat = 0-1) when the tour spins only 1 direction.

    Can you recommend a solution?

Jetzt mitmachen!

Sie haben noch kein Benutzerkonto auf unserer Seite? Registrieren Sie sich kostenlos und nehmen Sie an unserer Community teil!