Page 1 of 1
Pan node to specific direction on click
Posted: Fri Mar 09, 2018 2:06 pm
by kconklin
I might be missing something obvious, but is there a way to pan a node to a specific direction (N, S, E, W) on click of an object?
Re: Pan node to specific direction on click
Posted: Fri Mar 09, 2018 4:53 pm
by Hopki
Hi,
Yes you would use a move to view action.
The move to view action can use a pan angle, use the viewing parameters to see which pan angle you would need to use.
Regards,
Hopki
Re: Pan node to specific direction on click
Posted: Fri Mar 09, 2018 5:08 pm
by kconklin
The problem I was having with that is that each pano would require different parameters in the "move to view" action.
But I did get it to work this way:
Source: Mouse Click
Action: Go to URL
URL: <javascript call here>
Target: _self
Javascript for each compass cardinal point:
Pan to north
javascript:pano.moveTo(pano.getPan()-pano.getPanNorth(),pano.getTilt(),pano.getFov(),5.0);
Pan to south
javascript:pano.moveTo((pano.getPan()-pano.getPanNorth())+180,pano.getTilt(),pano.getFov(),5.0);
Pan to east
javascript:pano.moveTo((pano.getPan()-pano.getPanNorth())-90,pano.getTilt(),pano.getFov(),5.0);
Pan to west
javascript:pano.moveTo((pano.getPan()-pano.getPanNorth())+90,pano.getTilt(),pano.getFov(),5.0);
It works great.
Thanks,
Kevin
Re: Pan node to specific direction on click
Posted: Fri Mar 09, 2018 5:14 pm
by kconklin
I should have noted that I am rotating a compass dial with the cardinal points (as the pano pans) around a static compass needle, so the east and west javascript might be reversed based on the individual use or application of this technique.
Re: Pan node to specific direction on click
Posted: Sat Mar 10, 2018 1:04 am
by Tony
Hi Kevin,
Thanks for the information re using Go to URL for the pan movement, very helpful.
I should have noted that I am rotating a compass dial with the cardinal points (as the pano pans) around a static compass needle
Can I ask what actions you are using to effect the compass dial rotation?
cheers,
Tony
Re: Pan node to specific direction on click
Posted: Sat Mar 10, 2018 2:31 pm
by kconklin
It's just a modifier:
Target: Rotate
Source: Pan North
Factor: -1
Offset: 0
Note that this is not all my work - I leveraged some assets from others. But here is a component item for it:
Update - I just updated the component to add click spots for Northeast, Southeast, Northwest, and Southwest. Now there are no "dead spots" on the compass dial.
Component attached.