You are not logged in.

Dear visitor, welcome to 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.


Tuesday, March 15th 2016, 8:54pm

Call functions that live in three.krpanoplugin.js

Hi all

How do I call functions that live in three.krpanoplugin.js from my xml file. For instance when a hotspot is clicked I need to modify a 3d model material but I having hard time targeting functions that live in three.krpanoplugin.js.

My xml:

Source code

<action name='hotspot_clicked'>	plugin[threejs].changeTexture() /// was hoping something like this works</action>


Source code

function changeTexture(){	console.log('changeTexture called');}

Posts: 1,850

Occupation: Virtual Tours - Photography - Krpano developer

  • Send private message


Tuesday, March 15th 2016, 9:59pm

See Klaus's plugin.
It's got a plugin open source plugin on how to do this.

Use three.js (3d objects) inside krpano (with VR support)
KRPano Developer: Portfolio ::Gigapixel Tagging Solutions - Porfolio 2 :: Facebook :: Twitter ::


Tuesday, March 15th 2016, 10:14pm

Awesome Thank You!


Wednesday, March 16th 2016, 6:38pm

Still having issues here with calling plugin functions. I believe I have it set up properly but it's still generating an error WARNING: unknown action: plugin[threejs].changeTexture

Any suggestions?

EDIT: This works, minor mistake. But I did notice that the plugin functions are not available on onstart. Anyhow I'm happy I got this resolved.

in my xml

Source code

<action name='hotspot_clicked'>	plugin[threejs].changeTexture();</action>

In three.krpano.js plugin

Source code

local.registerplugin = function(krpanointerface, pluginpath, pluginobject){	//.......	//.....	plugin.changeTexture = changeTexture;
function changeTexture(){	console.log( 'changeTexture called');}

This post has been edited 1 times, last edit by "ecsancho" (Mar 16th 2016, 6:58pm)


Wednesday, March 16th 2016, 9:37pm


the name of the function at the plugin object need to be 'lowercase'!
Otherwise it wouldn't be callable by xml actions code.

Thats because all variable and function names that will be used in the xml will be internally converted to lower-case to be callable regardless of the case.

That means instead of:
plugin.changeTexture = changeTexture

this would need to be used:
plugin.changetexture = changeTexture

The case in the xml itself doesn't matter.

Best regards,