• Content Count

  • Joined

  • Last visited

Everything posted by Spankied

  1. 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. 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. 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 (; } }; let NavigationComponent = (base) => class extends base { foo() { console.log('foo from NavigationComponent'); if (; } }; class Player extends Entity.with(ActionComponent, NavigationComponent) { foo() { console.log('foo from Player');; } } 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. @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. (with StackPanel) (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. (clear) (dispose) *cough* @Deltakosh *cough*
  8. 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).
  10. solved by Ssaket.
  11. So this kinda works.. Breaks as soon as you play with canvas or browser dimensions. Next tried to do some calculations following this StackOverflow post 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 -
  12. The buttons onPointerOutObservable now triggers the rectangles as well. This isnt intended behavior. @Deltakosh
  13. I have a rectangle interface with an onPointerOutObserver handler that hides the interface. In the first playground, I can move the mouse anywhere in the interface and it will remain visible. 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 :
  14. The unity editor has a good solution for setting up navigation, editing meshes, and building worlds. Like Nodragem said, theres and editor for babylon, in which you can add particle systems, create and edit animations, and manage sounds. Currently, there are no features in the babylon editor to setup navigation, build an avatar, or build a world. I haven't used the editor; not really sure how. Because babylon is opensource, anyone can extend the functionalities offered. Here are some projects that inspire me. SataGuru's Character Controller Samuel's EnergyJS Mackey's Babylon Tool Kit Sergey's Power Planner For better or worse, Unity has some well defined ways of implementing game features. Babylon does not. Unity encourages developers to use the Entity-Component-System pattern to develop your game. You will find zero ECS implementations for babylon (except this one(shamless plug))
  15. Will be on the lookout for that github address, thank you.
  16. Lol good looks mate. I'll have to check all this out when I get home. Much appreciated.
  17. @MackeyK24 saves the day. Will be looking out for those unity videos.
  18. @satguru
  19. moveWithCollisions takes a velocity. The nav-mesh library outputs an array of positions. My question is how do I move a player using this array of positions. Using begin animation, I can set which position player should be at, at certain frames. This works well except I can't animate position and skeleton at same time. Halppp!1
  20. @MackeyK24 the issue with the toolkit are the docs. The getting started video link is broken, and I remember just seeing " please refer to unity docs" everywhere. I think there were a few examples, but some felt incomplete or were just api references. I havent watched a udemy course in like a year, but If u released one on the toolkit I would definately get it. Any video u release on the toolkit I'll watch, especially those in regards to navigation and animation. Idk why collision meshes or impostors never crossed my mind. Makes so much sense after reading ur post. I want to incorporate both lookAt functionalities u mentioned, but for now, just the second one, turning the capsule to face the movement direction. Is there another function other than lookAt u would use? If i moveWithCollisions to a point I can just look at that point before moving, but how would I do this for a player.position animation over an array of points? To elaborate on last question, moveWithCollisions only moves to one point, that's why I began an animation on the player.position value and made some frames for each point along the path, then play all frames. How would a moveWithCollisions refactor look? Does project.js also import the navigation-mesh library? If so how are u able to load it in the playground, I checked the navmesh library file and it tries to require a bunch of dependencies which the playground didn't like. Thanks for ur response Mackey
  21. @Sebavan I want to provide the most natural looking experience. My biggest concern for now is getting the skeleton animations to play along with the position animations/transform.
  22. @Sebavan The tutorial and github repo got me here. Not sure what you mean when you say lookAt will need some epsilon to not look shaky. My question with lookAt is how would you implement it? Would you look at path points, or subdivide between points, and look at subdivisions? And how would u know when to look at a point, would u constantly check if the player has reached certain points?