Lary

Members
  • Content Count

    39
  • Joined

  • Last visited

About Lary

  • Rank
    Advanced Member

Recent Profile Visitors

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

  1. Lary

    Water Effects

    Hi Fellow Friend, Is there any good way to construct water effects using BabylonJS? I used the official water material, it seems a bit blue...like ocean. I saw this demo and was quite impressed. see here . Can you share any demos that reach to this effects using BJS? Thanks!
  2. Lary

    Camera Inertia Angle

    Greeeeet! Thank you so sosososoos much Sable! It really saved me! I tested the values, and it is correct!!!!!
  3. Lary

    Camera Inertia Angle

    Thank you for correction. Wingnut. and all BJSers
  4. Lary

    Camera Inertia Angle

    var createScene = function () { // This creates a basic Babylon Scene object (non-mesh) var scene = new BABYLON.Scene(engine); // This creates and positions a free camera (non-mesh) var camera = new BABYLON.ArcRotateCamera("arcRotateCamera", 0, 0, 15, new BABYLON.Vector3(0, 0, 0), scene) camera.beta = Math.PI / 3; // This targets the camera to scene origin camera.setTarget(BABYLON.Vector3.Zero()); // This attaches the camera to the canvas camera.attachControl(canvas, true); // This creates a light, aiming 0,1,0 - to the sky (non-mesh) var light = new BABYLON.HemisphericLight("light1", new BABYLON.Vector3(0, 1, 0), scene); // Default intensity is 1. Let's dim the light a small amount light.intensity = 0.7; // Our built-in 'sphere' shape. Params: name, subdivs, size, scene var sphere = BABYLON.Mesh.CreateSphere("sphere1", 16, 2, scene); // Move the sphere upward 1/2 its height sphere.position.y = 1; // Our built-in 'ground' shape. Params: name, width, depth, subdivs, scene var ground = BABYLON.Mesh.CreateGround("ground1", 6, 6, 2, scene); //Camera rotation Detection let oriAlpha = 0; let oriBeta = 0; let oriDirAlpha = 0; let oriDirBeta = 0; let turnAlpha = 0; let turnBeta = 0; let infoAlpha = []; let infoBeta = []; // // let camera = scene.activeCamera; let timeStart = null; scene.onPointerObservable.add(() => { oriAlpha = turnAlpha = camera.alpha; // console.log(oriAlpha) oriBeta = turnBeta = camera.beta; oriDirAlpha = 0; oriDirBeta = 0; infoAlpha = []; infoBeta = []; timeStart = new Date().getTime(); }, 1) scene.onPointerObservable.add(() => { infoAlpha.push({ dir: (camera.alpha - turnAlpha) > 0 ? 1 : -1, angle: camera.alpha - turnAlpha }) if (infoAlpha.length === 1) { if (infoAlpha[0].angle === 0) { console.log("click") } else { var direction = infoAlpha[0].dir < 0 ? "Right:" : "Left:" console.log(direction + Math.abs(infoAlpha[0].angle * 180 / Math.PI).toFixed(0) + "°") } } else { var turns = infoAlpha.length; var turnInfo = ""; for (var i = 0; i < turns; i++) { var direction = infoAlpha[i].dir < 0 ? "Right:" : "Left:"; turnInfo += (direction + Math.abs(infoAlpha[i].angle * 180 / Math.PI).toFixed(0) + "°" + "\n") } console.log(turnInfo) } console.log("Duration:" + (new Date().getTime() - timeStart) / 1000 + "秒"); }, 2) camera.onViewMatrixChangedObservable.add(() => { let alphaDif = camera.alpha - oriAlpha; let betaDif = camera.beta - oriBeta; // console.log(alphaDif) oriAlpha = camera.alpha; oriBeta = camera.beta; if (alphaDif) { let dir = alphaDif > 0 ? 1 : -1; if (!oriDirAlpha) { oriDirAlpha = dir; // console.log(ariDirAlpha) } else { // console.log("turn:"+turnAlpha) if (oriDirAlpha !== dir) { infoAlpha.push({ dir: oriDirAlpha, angle: camera.alpha - turnAlpha }) oriDirAlpha = dir; turnAlpha = camera.alpha; } } } }) return scene; }; Hi all, I paste my code here, coz I wonder if what happens that I can't save a PG for your information. @Wingnut
  5. Lary

    Camera Inertia Angle

    Thanks Sebavan, yes, putting the inertia to 0 could help. But the rotation would be so slow and would affect the UE, So I'm trying to calculate the inertia angle, it maybe something like camera inertia * pointerMove length. aha, just my imagination..Hope @Deltakosh and @Wingnut could support me any idea~
  6. Hi there, Is there a way for me to get the ArcRotateCamera's rotation angle led by its inertia? I have pointerDown and pointerUp events to calculate how many angles I rotates during pointerEvent, but if I make a quick slide, the camera doesn't stop immediately after pointerUp, it will rotate for some angles due to inertia. Thanks!
  7. Hi friend, Is there any way to detect user panning and zomming the model with arcRotateCamera on both desktop and mobile? and also when the user put one finger down and pan the model continuously from right to left, and left to right. I need to track all the actions... Thaanks!!
  8. Hi @Wingnut and @Deltakosh, sorry to inform you late, finally I found a solution, by deleting the "canvas.tabindex = 1", then it works, though I don't know why..anyway, thanks!
  9. Hi Wingnut, the method by setting the canvas.focus({preventScroll:true}) seems not workable....Sorry about that, anyway thanks again. But I tried replacing the babylonjs version (babylon.3.1.1.min.js.) that has the scrolling problem with that not having the problem (Babylon.js engine (v3.1-alpha)), it works well. So I can partially confirm that there's difference in both versions that affecting the canvas focus. I need to look into it, I would be much appreciate if you could supply some information.
  10. Hi Wingnut, you're faster than the flash! Will try that, thanks first!
  11. I'm sorry for making the title that long....and also my content will be... Recently I'm quite tortured by a tricky problem, mainly on iOS mobile, things are like this... I inserted a Babylonjs project into a third-party homepage through iframe tags. As you know, the home page has header, footer, another content and the iframe part. When I scroll to the iframe part, and want to interact with the canvas, as long as I tap the canvas, the page jumps to the bottom immediately. Strange! I scroll back, and continue to pinch, rotate the canvas, it goes normally (do not touch other part, only the canvas after jumping). As long as I have tapped the UI, and then tap the canvas, history will happen again. I tried other projects (also build with Babylonjs), some will not have this problem. So I made a detailed comparison, excluding the potential problem raised by html ,css. The main difference might be the version of Babylon.js. The ones that have jumping problems use the babylon.3.1.1.min VERSION , while those don't have problem, use this Version , it's compressed and I forgot the version now. Can anybody tell which version the latter is? and what's difference between them, especially about issues like canvas focus, tapping event on iOS... The test link that having the problem is this , the visit speed might be slow out of China. But the problem will be like what I mentioned above. I guess it's something about canvas.focus(). but not sure..I know you guys are more experienced and smarter. I would really appreciate!!!!!!!! 5e2233d9ce8a56b9700997ac243d5838 (1).mp4
  12. Lary

    Remove Round Frames in VR

    Hi @Wingnut, thanks for the information,@JCPalmer 's camera works in my scene. Great! However, the scene in both view seems kinda tortured. What I'm using is scene.createDefaultVRExperience({createDeviceOrientationCamera:false}); which will create a webVR camera and non-webVR camera, and also a button enabling webVR access. I want this mode ,and keep both cameras. So by default, it is arcRotateCamera, when webVR triggers, the view has to be side by side with no round borders as above show. I wonder if there's a way? or I just need to correct a parameter? reference link here, in this demo, if I enter webvr mode there, it's side by side with no borders, but if I download the code and play at local, there has round corners, I don't know why....
  13. Hi there, Now I have a basic webVR demo from PG, when I enter into VR mode, there always be round frames/corners (below pic in red circle )at each view. Is there a way to remove them, and make the view on both side in full screen? Thanks!
  14. Thank you so much RaananW, it works!!! But the particle color seems bit different under the two modes.