sable

Members
  • Content Count

    88
  • Joined

  • Last visited


Reputation Activity

  1. Like
    sable reacted to Kreeba in Drawing Firing Arcs   
    Thanks for everyones help. I got them working fine with detection as well. Marked as solved
  2. Like
    sable got a reaction from simon_bg in Camera stumbling while dragging   
    Building on the above, for inertial movement you could use the built in inertial panning offsets (having changed the panning axis to 1,0,1), pg, see lines 113, 141, 142. But this has issues when beta is close to zero (looking straight down).
    You could instead roll your own inertia by just extracting the relative bits from the camera source, like so.
    Also if you want to be able to pan the camera like this without needing a ground mesh to do hit tests against, it's possible to project the mouse coordinates to an arbitrary plane in 3d space. For example the plane at y = 0, pg. Of course for your use case there might always be a ground mesh there in which case this doesn't matter too much.
  3. Like
    sable reacted to Kreeba in Drawing Firing Arcs   
    Thanks sable, that looks exactly what I want. I will go through and try to understand it a little later.
  4. Like
    sable got a reaction from Kreeba in Drawing Firing Arcs   
    This seemed interesting, so I had a play about with it.
    https://www.babylonjs-playground.com/#P4IH5X#1
    I'm not entirely sure if that's sort of what you were getting at or not, so let me know.
    EDIT:
    https://www.babylonjs-playground.com/#P4IH5X#2
    Mistake in first pg when sphere not at origin, see lines 110 to 112 --> I'd translated an already translated point
  5. Like
    sable got a reaction from Wingnut in Camera stumbling while dragging   
    Building on the above, for inertial movement you could use the built in inertial panning offsets (having changed the panning axis to 1,0,1), pg, see lines 113, 141, 142. But this has issues when beta is close to zero (looking straight down).
    You could instead roll your own inertia by just extracting the relative bits from the camera source, like so.
    Also if you want to be able to pan the camera like this without needing a ground mesh to do hit tests against, it's possible to project the mouse coordinates to an arbitrary plane in 3d space. For example the plane at y = 0, pg. Of course for your use case there might always be a ground mesh there in which case this doesn't matter too much.
  6. Like
    sable reacted to Wingnut in Camera stumbling while dragging   
    Hiya Simon.  Sorry for slow replies.
    I've been doing some testing.  [link pg #3]
    SOME progress, but... hmm. 
    I am printing diff to console @ line 125.  Open console and do slow drag on ground.  See diff alternating negative/positive?
    I think that is the problem, but I'm not sure WHY it is happening, yet.  I'll keep thinking/testing.  Others may have ideas/fixes, too.  Stay tuned.
    Update: [link pg #4]  There we go.  Line 141 was causing problems.  Nopped it out, life got better.  hmm. 
    You can remove lines 136, 137, too.  They are not necessary.  Party on.
  7. Like
    sable reacted to Deltakosh in .getHeightAtCoordinates() not returning height correctly when paired with .convertToFlatShadedMesh()   
    Done: https://www.babylonjs-playground.com/#U0L5NA
     
  8. Like
    sable got a reaction from Wingnut in .getHeightAtCoordinates() not returning height correctly when paired with .convertToFlatShadedMesh()   
    Seems like it would be fairly simple to do this.
    Assuming that std derivatives are supported you can implement it like this.
    Example playground with shader version on the left and convertToFlatShadedMesh on right: https://www.babylonjs-playground.com/#E0PJHQ
  9. Like
    sable got a reaction from Pryme8 in .getHeightAtCoordinates() not returning height correctly when paired with .convertToFlatShadedMesh()   
    Seems like it would be fairly simple to do this.
    Assuming that std derivatives are supported you can implement it like this.
    Example playground with shader version on the left and convertToFlatShadedMesh on right: https://www.babylonjs-playground.com/#E0PJHQ
  10. Like
    sable got a reaction from Pryme8 in [SOLVED] Determine camera distance to make mesh fit   
    Hadn't thought about scaling. You could use
    let radius = mesh.getBoundingInfo().boundingSphere.radiusWorld; to get it working for any scale.
  11. Like
    sable got a reaction from ozRocker in [SOLVED] Determine camera distance to make mesh fit   
    Hadn't thought about scaling. You could use
    let radius = mesh.getBoundingInfo().boundingSphere.radiusWorld; to get it working for any scale.
  12. Like
    sable reacted to Hanesu in Controlling the render loop   
    That's it, the second PG does exactly what I need. Thank you so much, you made my week! 
  13. Like
    sable got a reaction from Tibotiber in Controlling the render loop   
    The inputs to arc rotate camera don't modify the alpha/beta/radius directly, but rather modifies inertialAlphaOffset, inertialBetaOffset and inertialRadiusOffset, which in turn sets the alpha, beta and radius of the camera (adds the offset, then multiplies the offset by inertia, repeat until the offset is ~0, see here).
    If you just want to make sure movement hasn't been buffered while the render is stopped, you can just set these offset to 0 before the render.
    https://www.babylonjs-playground.com/#AFPV4K#2
    If you just want to allow rendering while the camera is moving, you can however just use a render loop that checks if these values are not 0.
    https://www.babylonjs-playground.com/#AFPV4K#5
    @Deltakosh When inertia is set to 0 in the above pg, the movement seems to be a frame behind (if zoom in then out, the first frame after the zoom out scroll wheel tick will zoom in). Something to do with render order? Also if you zoom, then just click move to rotate normally, it will do the final zoom on that render.
  14. Like
    sable got a reaction from ozRocker in [SOLVED] Determine camera distance to make mesh fit   
    http://www.babylonjs-playground.com/#GQWGC0#3 is what I've used before, which I adapted from https://www.opengl.org/discussion_boards/showthread.php/169865-Zoom-to-fit-screen/page2
    Looks like a similar solution to the one at the end of the thread @Wingnut posted.
  15. Like
    sable got a reaction from Deltakosh in Controlling the render loop   
    Not really, was just curious why this seemed to only happen with an inertia of 0.
  16. Like
    sable got a reaction from StarToaster in Finding four nearest corners of a sphere's bounding box and project them into screenspace?   
    http://www.babylonjs-playground.com/#N9MYJN#3
    The projection was fine, just needed to not center the text (i.e. not set margin alignment to center), and translate the y coord from screen coords to canvas2d coords (canvas2d has the origin at the bottom left as opposed to the top left).
    Also needed to get the closest corners I needed to slightly change your sorting function so that it used the distance property that you'd calculated.
    Edit:
    If you're not too invested in canvas2d, and depending on what you need to do, it may make sense to move to Babylon.GUI, which is currently better maintained.
    http://www.babylonjs-playground.com/#N9MYJN#4 - the equivalent of the previous pg in Babylon.GUI
    http://doc.babylonjs.com/overviews/gui
  17. Like
    sable got a reaction from jerome in Finding four nearest corners of a sphere's bounding box and project them into screenspace?   
    http://www.babylonjs-playground.com/#N9MYJN#3
    The projection was fine, just needed to not center the text (i.e. not set margin alignment to center), and translate the y coord from screen coords to canvas2d coords (canvas2d has the origin at the bottom left as opposed to the top left).
    Also needed to get the closest corners I needed to slightly change your sorting function so that it used the distance property that you'd calculated.
    Edit:
    If you're not too invested in canvas2d, and depending on what you need to do, it may make sense to move to Babylon.GUI, which is currently better maintained.
    http://www.babylonjs-playground.com/#N9MYJN#4 - the equivalent of the previous pg in Babylon.GUI
    http://doc.babylonjs.com/overviews/gui
  18. Like
    sable got a reaction from hunts in Catmull curve not working   
    Just needs to be passed an array of points, not the points themselves. See line 59.
    http://www.babylonjs-playground.com/#1PSZDF#36
  19. Like
    sable reacted to NasimiAsl in Pure GPU particle system   
    hmm
    http://www.babylonjs-playground.com/#1QC9DP#155
    for make dynamic wind effect (in GPU side  ) for any geometry it take a lot time but we can make some special 
    anyway if you wanna make that in cpu side i think @jerome can help you 
    but for GPU side maybe you define special requirement about effect i try make it but for general GUP-particle system  i think you need wait for next version of BJS
     
  20. Like
    sable got a reaction from Spankied in Babylon mouse control   
    I'm not entirely sure if this is what you want, but the following pg has one end of the line following the pointer.
    https://www.babylonjs-playground.com/#03QEFL
  21. Like
    sable got a reaction from Wingnut in CreateScreenshot is not working on V3   
    Try changing
    window.engine = new BABYLON.Engine(canvas_model, true); to
    window.engine = new BABYLON.Engine(canvas_model, true, {preserveDrawingBuffer: true});  
  22. Like
    sable got a reaction from hit2501 in CreateScreenshot is not working on V3   
    Try changing
    window.engine = new BABYLON.Engine(canvas_model, true); to
    window.engine = new BABYLON.Engine(canvas_model, true, {preserveDrawingBuffer: true});  
  23. Like
    sable got a reaction from Deltakosh in CreateScreenshot is not working on V3   
    I think you just need to set preserveDrawingBuffer to true when creating the engine, i.e.
    new BABYLON.Engine(canvas, true, {preserveDrawingBuffer: true});  
  24. Like
    sable got a reaction from Raitch in Cannot read property 'isDisposed' of undefined   
    I've run into this issue a couple of times myself. I've managed to reproduce it in a playground, here.
    All the pg does is put points down in the scene, and displays the distance between each (I was trying to build a measuring tool similar to the one in googleMaps when I stumbled across this issue).
    This will cause the crash when the last point is removed (click to make a point, click again to remove it). Wrapping the dispose calls in a setTimeout avoids the crash (which is the workaround I'm using for now), as does changing isVisible on line 35 to true, and commenting out the levelvisible assignments on lines 87 and 94.
    On an unrelated note, unless I'm missing something, it seems that picking with pointerTap and pointerUp is broken in the playground, as they always return a null pickInfo object (which is why I'm using pointerdown in the above pg).