Back to the Shapespark home page

[Bug] Script extension not working on object trigger

Hello everyone,

the script extension is not working when I use an object as trigger. It works fine when using the sphere or sprite. In the same scene, others scripts work fine with an object trigger. My solution right now is to put an opacity 0 sphere around it (even though we still see a light shadow on it, would be nice to have the option for completely invisible sphere :slight_smile: ) but then I miss some behaviour (the trigger is supposed to change its emissive settings on hover).

Any solution ?

Thanks !

Could you send link to your scene, to allow us to reproduce the problem ?

Hi Robert, I sent you the scene via private message. Thanks a lot !

To fix the problem you should add body-end.html with the following content:

WALK.getViewer().setMaterialEditable(‘glow_brake_toggle’);

By default materials are not editable (for performance reasons) and if changing material properties is required, then it must declared before scene loading.
Detailed information about using body-end.html and enabling material edition may be found on:

Hi Robert,

I think the issue is somewhere else, I have “viewer.setAllMaterialsEditable();” in my file (it’s not in the package I sent you because I have a modified index.html on my server). The issue is not about the script but the click on the object. I tried with a simple “console.log(“test”);” and it wasn’t working either.

Did you manage to reproduce the error on your side?

Thanks for looking into it

Hi Thyronia,
I reproduced this problem and then fixed it by adding body-end.html file.
In fact in downloaded scene trigger type for ‘Script_brake_glow’ is set to ‘Sphere’, but I changed it to ‘Object type’ and selected object ‘Group#228’. But as you wrote the problem is not related to materials.
Does problem occur also in Editor ?
Does problem occur on each selected object ?
Are there other triggers linked to given object ?

Hi Robert,

I think I was using the group above “Group#228” because now it seems to work, I only need to make it unique in Sketchup now haha.

Thanks for the help !

Hi Thyronia,
In your case it is not a solution. In fact the root of problem is that you have linked to ‘Group#228’ ‘Break_news’ extension and this one is executed when user clicks ‘Glow series’. The solution is to not link any extension to ‘Group#228’ as this object type has many representors in scene. Instead ‘Break_news’ extension should be linked to ‘break#2’ and ‘break_blow’ extension back to ‘break#8’.