Spankied

Members
  • Content Count

    75
  • Joined

  • Last visited

About Spankied

  • Rank
    Advanced Member

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

  1. Spankied

    Build grid from existing scene for path finder

    The best way to do this is to create a navigation mesh on your scene. Then when the user clicks on an area, if the navigation mesh is picked I move the character to that point on the mesh. pointerDown(evt){ let scene = this.scene; let pickResult = scene.pick(scene.pointerX, scene.pointerY); if (pickResult.pickedMesh == scene.getMeshByName("Navmesh")) { this.player.trigger('move', pickResult.pickedPoint.clone()) //player.action } else { this.showActionMenu(pickResult.pickedMesh, scene) } } Heres some resources for baking a nav mesh. https://docs.blender.org/manual/en/dev/game_engine/physics/types/navigation_mesh.html https://www.youtube.com/watch?v=aMWeTXL98mM You can checkout my code here and see demo here. Also, Wanadev created a pathfinding library for babylonjs that uses the A* search algorithm to find a path on a nav mesh.
  2. Spankied

    Can Babylon help with game logic?

    I'm working on an ECS. You can checkout code here. Below is a snippet of how its structured. class Entity { foo() { console.log('foo from Entity'); } } Entity.with = function (...components) { return components.reduce((base, component) => component(base), this); } let ActionComponent = (base) => class extends base { foo() { console.log('foo from ActionComponent'); if (super.foo) super.foo(); } }; let NavigationComponent = (base) => class extends base { foo() { console.log('foo from NavigationComponent'); if (super.foo) super.foo(); } }; class Player extends Entity.with(ActionComponent, NavigationComponent) { foo() { console.log('foo from Player'); super.foo(); } } new Player().foo();
  3. Will changing Control.AllowAlphaInheritance = true fix it. I've tried in the playground.
  4. Yes. The extension utilizes metadata exported from Unity by the toolkit to offer babylonjs analogs to features Unity offers. This includes, component scripting & blend trees. When you preview a scene using the editor toolkit in Unity, this code gets ran in the preview window.
  5. Took me a minute to understand. You are saying that it does switch from hover state back to its original alpha, which is .9 because it doesnt inherit the containers .4 ?
  6. So should I dispose the ADT instead, and reinstantiate it everytime? I want to hide the Menu and get rid of the buttons onPointerOut. Also, can you look into why these button stay in hover state, even after pointer out. https://www.babylonjs-playground.com/#PUC95T @Deltakosh
  7. This one gets ugly. Rectangle controls on Rectangles controls doesnt work, so I layer a StackPanel in between. This messes up the root rectangles onPointerOut observable. https://www.babylonjs-playground.com/#XQLXSI (with StackPanel) https://www.babylonjs-playground.com/#XQLXSI#1 (without) Check console logs, notice onPointerOut for PG with StackPanel is only triggered sometimes. Not sure under what conditions the rectangle control's onPointerOut is triggered. The second playground, rectangles on rectangles, is missing the 'Choose Option' header. Also, AdvancedDynamicTexture.clear() appears to do nothing. I expect it to behave similar to dispose? Trigger an onPointerOut to reproduce. https://www.babylonjs-playground.com/#URLPY2 (clear) https://www.babylonjs-playground.com/#URLPY2#1 (dispose) *cough* @Deltakosh *cough*
  8. Spankied

    ArcCamera control locks to pointer

    I edited my OP and the PG with new info on issue
  9. Not really sure whats going on here. Normally ArcCamera allows you to control the camera angle onPointerDown and releases its control onPointerUp. However, when I also modify a user interface onPointerDown, the ArcCamera control is locked, and isnt realsed until the interface is not visible (click button). https://www.babylonjs-playground.com/#TWTL5J
  10. Spankied

    Position GUI control at PointerDown

    solved by Ssaket. https://www.babylonjs-playground.com/#LRS51E
  11. So this kinda works.. https://www.babylonjs-playground.com/#NVY5B4 Breaks as soon as you play with canvas or browser dimensions. Next tried to do some calculations following this StackOverflow post https://www.babylonjs-playground.com/#NVY5B4#1 The PG is broken, canvas.getContext('2d') returns null. I suspect I will need to get the AdvancedTexture context, but not sure how. Than use it's currentTransform property to calculate the position. Open to ideas. Solved by Ssaket - https://www.babylonjs-playground.com/#LRS51E
  12. Spankied

    Is Babylon.js for me ?

    10-32 shots fired
  13. The buttons onPointerOutObservable now triggers the rectangles as well. This isnt intended behavior. @Deltakosh´╗┐
  14. I have a rectangle interface with an onPointerOutObserver handler that hides the interface. https://www.babylonjs-playground.com/#65I7QC In the first playground, I can move the mouse anywhere in the interface and it will remain visible. https://www.babylonjs-playground.com/#65I7QC#1 In the second, if I hover over the button in the interface, the interface is hidden. This is not intended behavior. If I set button.isHitTestVisible = false, the rectangle observer isnt triggered. But the button observables wont be triggered. I think the functions in question are _processObservables and _processPicking here fixed : https://github.com/BabylonJS/Babylon.js/commit/a562a1e65d6d3e14302917cb431300fea58e8e10#diff-9559663657d125fa39095d417d2d99a6