Tomek

Members
  • Content Count

    15
  • Joined

  • Last visited

About Tomek

  • Rank
    Member

Recent Profile Visitors

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

  1. @Deltakosh Thanks for the tips! I solved it - https://playground.babylonjs.com/#92LK47#12.
  2. Hello, I want to control the camera position with 'WASD' keys. More specifically the targetScreenOffset. I managed to do it but now I want to add animation so the movement is smooth. However, when you hold the key down animations overlap each other causing some stutter. Also when I click rapidly different keys there are some "jumps" from one position to another. Here's the example: https://playground.babylonjs.com/#92LK47#7. How could I fix it, maybe with some throttling?
  3. This is kind of referencing another topic but this question is about something else. I'm creating something I call "anchors" which is basically a GUI control stuck to the mesh. Right now I have a scene where with a click you can add the anchor and move it with Gizmo by clicking on it again. What I now try to do is to make these anchors/GUI buttons half visible when behind an object. This is where I am right now: https://www.babylonjs-playground.com/#RQ2T0A#23. It kind of works... besides some spontaneous flashing when moving the camera. But the bigger issue is when I load a Yeti model: https://www.babylonjs-playground.com/#RQ2T0A#24 - it doesn't seem to work at all. I bet this has to do with this https://github.com/BabylonJS/Babylon.js/issues/5386. I'm not sure what's the best approach here or how to fix it...
  4. I tried that before and I think it will be a good enough approach to what I'm looking for. My initial aim was to be able to somehow pick the exact place in the space or a model. Let's say that these anchors are gonna open up some comment, it would be a cool feature if a user could just rotate a model then click a place on this model and anchor would be then pinned exactly to that place. But this gets complicated because of the "Bones" (which I don't get yet) and basically handling clicks outside of the model. Still curious about @dbawel solution though 🙂 I really appreciate all of the feedback you gave me.
  5. @JohnK thanks! I don't know all of this math so I cannot improve it 😅 I thought about that wall from the first examples... https://www.babylonjs-playground.com/#RQ2T0A#16. Here I have added a fake wall and after the click, the anchor is placed always under the pointer. Though there are some problems with this approach: it's a fixed depth. if someone moves away enough from camera he will be limited to the wall size when placing anchor which also... ...requires some computations probably so the wall is always bigger than the model anchors are initially placed inside the model, It's an extra mesh that someone has to be aware of (?) As of point 4 - it works better when there are no bones https://www.babylonjs-playground.com/#RQ2T0A#17 Maybe most of these problems could be fixed with some kind of a bounding box 🤔
  6. UPDATE: * I have a way to move once created anchor with a Gizmo * I have a way to intercept clicks on the scene and add a new anchor The problem is I cannot properly set initial position for a new anchor after the user click. I gave up on counting a distance between a model and camera for now. Having a gizmo set, it would be good enough to just click on the canvas and then create an anchor right under the mouse pointer and with some default distance from the camera. But this is not easy, as I don't know how to take the camera position into account and set depth properly so the anchor stays under the mouse pointer. Is it possible even without some hard math? This is where I stuck - https://www.babylonjs-playground.com/#RQ2T0A#14 . Any help would be appreciated.
  7. UPDATE: I think I'm getting somewhere. I mean I found a way with Gizmos how to position an element after it has been misplaced in space - https://www.babylonjs-playground.com/#RQ2T0A#12 Primarily the function of these pinpoints/anchors is to be something else, but I can imagine that this Gizmo function can be triggered by something like a double-click maybe (though I didn't found a way to receive double clicks) to change anchor position. Still, I'm don't know really how to pick a good initial Z distance from the camera (depth of anchor). Maybe something like a bounding box could help? Maybe then I could use this logic: if it's a bounding-box hit then I'll place an anchor on that specific place on the bounding box. If it's a space I will pin an anchor to the middle of the world. I both cases the user can correct the anchor with Gizmo.
  8. Actually I just handled it like this and it seems to work: scene.animationsEnabled = true; scene.animationsEnabled = false;
  9. Tomek

    pickMesh doesn't return any meshes

    Thanks for looking into this!
  10. Hi guys, I can't get my head around it. I have a loaded model https://www.babylonjs-playground.com/#RQ2T0A#7 and I try to get meshes when I click on the Yeti, but it always returns an empty array...
  11. You need to keep it as static file somehow (even though it's not imported anywhere in the code), with Create-React-App you do this by putting the model into public/ directory - https://codesandbox.io/s/5vj36805nk
  12. I can see that there is a method called stopAllAnimations I wonder how to do the opposite (after I have stopped them) and run them all again? I tried: newScene.meshes.forEach(m => newScene.startAnimation(m)); but it doesn't work.
  13. @Wingnut thanks a lot, I really appreciate your feedback. I'm missing something fundamental here. How is Mesh created with Babylon different from meshes loaded with SceneLoader (I mean `newScene.meshes` property)? Back to yeti example - I tried to create multi-pick but it always returns an empty array - https://www.babylonjs-playground.com/#RQ2T0A#7
  14. Hi guys, Thanks a lot! This gives me some ideas for further research. The general impression I get is that I should apply this kind of logic: create a Plane far, far away to be sure it's behind the loaded model then I can distinguish if the click happened on the space (when hit the plane) or else it must have been somewhere on the model Right? Using multi-pick option is also interesting, maybe I could do something with that information 🤔 . @dbawel Your solution seems to be close to what I'm looking for, would you mind sharing some example? I will be sharing my progress.
  15. Hi, this is my first post on this forum so I would like to say that BabylonJs is awesome and it has a great community! I'm working on a project and I would like to allow the user to select a point in the space (so I could later pin a GUI button or a mesh there). My first idea is that if I could detect that user is trying to click on the model then I would assume that the point is on the model, else if it's the space I could probably use some default distance from the camera. I have read about collisions and end up with this example: https://www.babylonjs-playground.com/#RQ2T0A#6. The problem is that "click" handler always returns "hit: false" I assume that's because of the Yeti isn't something like mesh created with MeshBuilder. How could I fix it? By the end, my final goal is to create some kind of indicator that would help the user visually pick that point (maybe some crossing lines or whatever). Any suggestions would be much helpful!