# Lary

Members

39

• Rank

## Recent Profile Visitors

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

1. ## 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. ## solved Camera Inertia Angle

Greeeeet! Thank you so sosososoos much Sable! It really saved me! I tested the values, and it is correct!!!!!
3. ## solved Camera Inertia Angle

Thank you for correction. Wingnut. and all BJSers
4. ## solved 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. ## solved 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. ## solved Camera Inertia Angle

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. ## Detect Panning and Zomming

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. ## Page embeded with iframe Jump to Bottom when Tapping Canvas

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. ## Page embeded with iframe Jump to Bottom when Tapping Canvas

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. ## Page embeded with iframe Jump to Bottom when Tapping Canvas

Hi Wingnut, you're faster than the flash！ Will try that, thanks first!