• Hello,

    I was asked about a follow mouse control mode,
    such control mode doesn't exists currently in krpano,
    but it would be very easy to implement it as plugin:

    • add a ENTER_FRAME handler
    • look for the mouse coordinates
    • modify the hlookat_moveforce / vlookat_moveforce values accordingly


    here is an example plugin source code:

    AS3 plugin code:


    here an online example with it:
    Follow Mouse Plugin Example


    download the plugin and source here:
    followmouse_plugin.zip
    followmouse_sourcecode.zip


    best regards,
    Klaus

  • Hi Klaus,

    The plugin works great, and makes total sense.

    One issue I'm having is disabling it... Here's my XML:


    <plugin name="followmouse"
    url="followmouse.swf"
    enabled="false"
    capture="false"
    />

    The reason I'm doing this, is because I don't want to enable it until my initial animation sequence has finished. Have I typoed in my XML, or is there a problem with disabling this plugin? This is the first time I've tried disabling a plugin, next step will be for me to figure out how to re-enable it *wink*

    Thanks for the help,
    John

  • Hi, that's just because this plugin doesn't listen for removing, sorry

    here is an updated plugin code with a remove event,
    now removeplugin() will work:

    AS3 plugin code:

    and here an updated swf:
    followmouse_v2.zip

    best regards,
    Klaus

  • Hi,

    here another follow mouse plugin variant:

    it follows the mouse only on the outer area of the pano,
    and allows normal control in the center,
    and as addition in this plugin the movement stops when the mouse leaves the screen/pano,

    here the as3 code:

    and here as download: (.swf and .as)
    followmouse_v3.zip

    best regards,
    Klaus

  • Klaus,

    I have a map that slides out from the side on hover, and I was wondering if there was a way to disable this plug in
    when the mouse is hovered over the map

    thanks so much for the help

    you truly are the pano king

    -K

  • var mx:Number = stage.mouseX;
    var my:Number = stage.mouseY;
    var sx:Number = stage.stageWidth * 0.5;
    var sy:Number = stage.stageHeight * 0.5;

    Maybe 'stage' must be something else when using an area. area instead of stage? Don't think so?

  • Hi,

    var mx:Number = stage.mouseX;
    var my:Number = stage.mouseY;
    var sx:Number = stage.stageWidth * 0.5;
    var sy:Number = stage.stageHeight * 0.5;

    Maybe 'stage' must be something else when using an area. area instead of stage? Don't think so?

    right, to get it working with area you need to use also the area size and position,

    e.g.

    Code
    var area:Object = krpano.get("area");
    
    
    var mx:Number = stage.mouseX - area.pixelx;
    var my:Number = stage.mouseY - area.pixely;
    var sx:Number = area.pixelwidth  * 0.5;
    var sy:Number = area.pixelheight * 0.5;

    best regards,
    Klaus

  • klaus, danke nochmals für die hilfe!
    funktioniert jetzt und ich kann im panorma nur durch kopfbewegung navigieren (mittels track-ir und diodenkappe).
    allerdings ist die bewegung sehr schnell.kann man die geschwinkdigkeit, trägheit etc. auf einfachen weg gut einstellen, ansonsten dreht es viel zu schnell, wenn ich nur ein bißchen denkopf bewege. stelle es mir so vor, wie beim ms-flight-simulator, da funktionioerts perfekt mit der kopfdrehung/bilddrehung (aussicht aus dem flugzeug z.b.).
    danke
    lg pauli

  • He Pauli,

    do you use those virtual goggles??

    Which ones? i'm looking forward to use those as well..

    can you provide some info??

    I think you can probably change the turning with the settings with the plugin where you also can see the lookto etc ..
    have a play with that..

    I think it's the options plugin.. else the editor..

    Cheers

    Tuur *thumbsup*

  • Nice plugin! I'm trying to create a toggle on/off mouse follow option on my tour. However when I do this

    Code
    <action name="mouseFollowOff">
    		removeplugin(mousefollow);
    	</action>

    the player wont stop looking at the sky. The plugin is disabled but when I try to drag the view back to the center, it would go back looking at the sky.

    Here's how i declared the plugin.

    Code
    <plugin name="mousefollow" 
    		url="%SWFPATH%/plugins/followmouse.swf" 
    		keep="true"
    		enabled="true"
    	/>

    Here's how i am removing it, just removed the unnecessary middle section like alpha, blendmode, etc.

    Code
    plugin name="mouseFollowOffBtn" url="mouse-follow-off.png" alpha="0.9"  y="-4" x="695" onclick="action(mouseFollowOff);"/>

    Is there a way to fix this?

    thanks,
    Milo

Participate now!

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