Hi everybody,
(Sorry for my English, I hope you will understand me)
I am starting on babylonJS and JavaScript but I have succeeded to create a kind of “virtual visit”. But now after that code, I wanted to structure it. Here is my “virtual visit” : https://www.babylonjs-playground.com/#FFACFW#16
Here my beginning of code “structured” : https://www.babylonjs-playground.com/#8987DV#10
Here my problem: I want to create my triggers now with the actionManager ( I succeeded with my first code without classes). So I have created my class Trigger. Untill here, all is ok, my spheres are displayed etc… To create different animation ( new material on a mesh etc…) I created a class Animation where I keep the code for changing the material etc…
here my classes Trigger & Animation :
So my problem is that this.animation is not recognized in the function of mesh.actionManager
but this.animation is recognized in the function addPointerOverTrigger before the mesh.actionManager.
When I run it with this.animation in the function of mesh.actionManager :
“this.animation is undefined”
But when I run it without that and this.animation before mesh.actionManager so all is Ok but it’s not what I want…
I have tried to give a parameter to the function of mesh.actionManager : function(this.animation) but It’s not working.
I have tried also to give a parameter to the trigger with mesh.actionManager.registerAction(new BABYLON.ExecuteCodeAction({ trigger: BABYLON.ActionManager.OnPointerOverTrigger, parameter: this.animation} , function () })); but it’s not working too…
I don’t understand why all function of babylonJS can be called in the manager but not this.animation.
Please can you help me?
Hope you will find a solution.
Best regards.