Jump to content

Search the Community

Showing results for tags 'observable'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • HTML5 Game Coding
    • News
    • Game Showcase
    • Facebook Instant Games
    • Web Gaming Standards
    • Coding and Game Design
    • Paid Promotion (Buy Banner)
  • Frameworks
    • Pixi.js
    • Phaser 3
    • Phaser 2
    • Babylon.js
    • Panda 2
    • melonJS
    • Haxe JS
    • Kiwi.js
  • General
    • General Talk
    • GameMonetize
  • Business
    • Collaborations (un-paid)
    • Jobs (Hiring and Freelance)
    • Services Offered
    • Marketplace (Sell Apps, Websites, Games)

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


Website URL


Twitter


Skype


Location


Interests

Found 7 results

  1. Well, my codes were working fine yesterday, this morning something went awry with my pointer observables. Dug a little into it and found similar reproducible results in https://doc.babylonjs.com/how_to/interactions . The playground example (https://www.babylonjs-playground.com/#0XYMA9#1) is working fine for the stable version, when I switch to latest version, clicking on the sphere or plane no longer triggers the pointerup event until I doubleclick. Consistent in the console log as well.
  2. Hi everybody: Only a quick question. Usually I prefer to use "Observables" over others BJS alternatives, in order to manage all user interaction, namely: myScene.onPointerObservable.add(onPointerDown,BABYLON.PointerEventTypes.POINTERDOWN); myScene.onPointerObservable.add(onPointerUp,BABYLON.PointerEventTypes.POINTERUP); myScene.onPointerObservable.add(onPointerMove,BABYLON.PointerEventTypes.POINTERMOVE); ... This works great but it lacks of the functionality of changing the pointer to the one with the hand, so I need to add an extra step, by means of Action Manager: myMesh.actionManager=actionManager; myMesh.actionManager.registerAction(new BABYLON.DoNothingAction(BABYLON.ActionManager.OnPointerOverTrigger)); /*pointer change*/ Obviously, using the resources of an Action Manager only for the "cosmetic" aim of change the pointer is an overkill. Is there any more clever alternative? Thanks for your time.
  3. Hi all! My geme have a menu_1 with buttons, if you click some button, then over an old menu_1 creates a new menu_2 with new buttons, but buttons from menu_1 react for click even if it under of new menu_2. I mean, if my button have observable PointerUp and I am creates sprite over this button, then this button react for PointerUp anyway, even under sprite, how I can hide all Observable buttons under one big sprite, that it don't react for pointer, but when I am delete my big sprite, then buttons start react on poiter again? Thank
  4. Hello, I find that the Observable class is useful to handle events. However the ActionManager class offers more types of events such as long press for instance but we can only use it on meshes. I would like to know the fundamental difference between these two classes. Does one depend on the other ? How can I reproduce the events from ActionManager for the Observable ? Thanks
  5. 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 assign to a local variable first, then it works, e.g. class MyMesh extends BABYLON.Mesh { private myMeshChild:BABYLON.Mesh; constructor() { // Create child mesh and add some animation etc. let myMeshChild = this.myMeshChild; this.myMeshChild.onBeforeRenderObservable.add(function () { console.log(myMeshChild.rotation); } } } I feel like I'm using Observables all wrong in Typescript. I'm wondering what's the best way to pass variables to the callback function from within my TS classes? Also I feel like if I add an observer to a mesh then the callback function should be aware of the context i.e. the mesh object from which it's called and therefore I shouldn't have to also assign objects to local variables before I can refer to them in the function, but maybe I'm expecting too much. Any pointers on using Observables correctly from within Typescript classes would be most appreciated. @Nockawa @Deltakosh
  6. Hi, I prepare simple playground : http://www.babylonjs-playground.com/#UP2O8#33 You can see I have registered a CollideObservable in sphere, but when another box cross it, it dosen't execute callback function. Can anybody show me how to use onCollideObservable method?
  7. Hey everyone I am not sure why but if I create two ScreenSpaceCanvas2D in two different scenes, one of the scenes being shown and not the other (stored in a parent object). The function Canvas2D.prototype._updatePointerInfo is called twice each time I move the mouse, once for the shown Canvas, and once for the canvas that is in the stored scene. Since I did not declare a camera in that stored scene the bit of code in babylon.max.js 44657 : Canvas2D.prototype._updatePointerInfo = function (eventData, localPosition) { ... var camera = this._scene.cameraToUseForPointers || this._scene.activeCamera; ... } return camera as undefined. And later on while the function tries to access camera.viewport it returns an error. This report is not really about solving the bug because if I declare a random camera for the stored scene (like a normal human being not trying to find bugs everywhere) i do not get the error. But I think it was not on purpose that events are captured on a canvas in a scene that is not currently rendered. All in all it is not a real problem for me but it might cause trouble for other people. To change between scenes I use this bit of code /* --- Start the render loop --- */ taskObject.engine.runRenderLoop(function () { taskObject.scenes[taskObject.currentScene].render(); }); This is the call stack for the error: Uncaught TypeError: Cannot read property 'viewport' of undefined @babylon.max.js:44665 Canvas2D._updatePointerInfo @ babylon.max.js:44665 Canvas2D._handlePointerEventForInteraction @ babylon.max.js:44628 (anonymous function) @ babylon.max.js:44549 Observable.notifyObservers @ babylon.max.js:3399 _onPointerMove @ babylon.max.js:15232 It seems the observables are set up at scene creation and down the callback chain there is no test to check wether the scene is currently being rendered (is that even possible?).
×
×
  • Create New...