Search the Community
Showing results for tags 'observer'.
-
I'm still a relative newbie with BJS and typescript. I've managed to get observers working in my TS class but I found that I couldn't use "this" instance references within the callback function e.g. class MyMesh extends BABYLON.Mesh { private myMeshChild:BABYLON.Mesh; constructor() { // Create child mesh and add some animation etc. this.myMeshChild.onBeforeRenderObservable.add(function () { console.log(this.myMeshChild.rotation); } } } This compiles fine but results in runtime error "Cannot read property 'rotation' of 'undefined'". But if I instead
- 3 replies
-
- observable
- observer
-
(and 2 more)
Tagged with:
-
Hello I am trying to serialize the scene with BABYLON.SceneSerializer.Serialize(scene) and am getting a "mesh.rotation.asArray is not a function". Serialization works fine when meshes are not rotated. On further exploration, I realised that that mesh.rotation was not a Vector3 object but an object with getters, setters and __op__: Observer. Could this be the issue? Can you please help me fix this. Please let me know if you need more details. Thank you
-
Hi, I have implemented a simple Observer Pattern library in TypeScript/JavaScript which does not require inheritance. I have called it Paon (French name for a bird with many "eyes" on its feathers). It is available in my GitHub and in npm. Any feedback would be greatly appreciated. Paon An Observer Pattern Component in TypeScript/JavaScript. No dependencies. No inheritance is required. Observable is just a component inside an object. Observers are just functions. Installation npm install paon To compile the TypeScript source to Jav
-
Hi, I prepare simple playground http://www.babylonjs-playground.com/#21STMC#0 Can anybody show us how to program switchForBall as observer and ball which trigge switchForBall? greetings