Juncheng

Members
  • Content count

    5
  • Joined

  • Last visited

  1. Hi guys, I have a problem when I use pep and arcRotateCamera. I found when I accidentally move my mouse out of the canvas while rotating the camera and then release the left mouse click down outside the canvas, the canvas still register the mouse down action. So at this time, I can rotate the camera without click any mouse button. I tried on ArcRotateCamera tutorial playground https://www.babylonjs-playground.com/#GH5SVN#1. I got the same problem. Can anyone tell me how to solve this problem? Best, Jason
  2. Hi, I have a question. How to touch pan the mesh in canvas? I have a setup with an arcRotateCamera and pep.js. On the desktop, the panning with right click on mouse works fine. On the mobile, one finger rotation and pinch zoom worked, but two fingers panning is not working. I am not proficient with web developing, hope I could get some ideas from you guys. Thanks! The code snippet for the camera: // the camera camera = new BABYLON.ArcRotateCamera("Camera", 1.575, 0.75, 20, BABYLON.Vector3.Zero(), scene); camera.setPosition(initCameraPostion); camera.setTarget(BABYLON.Vector3.Zero()); camera.inertialRadiusOffset = 0; camera.allowUpsideDown = false; camera.pinchPrecision = 5; camera.wheelPrecision = 10; camera.fov = 0.01; camera.panningSensibility = 500; camera.panningInertia = 0.1; scene.activeCamera = camera; scene.activeCamera.attachControl(canvas, false, false); The code snippet for canvas and pep: <!-- import pep.js --> <script src="https://code.jquery.com/pep/0.4.3/pep.js"></script> <!-- canvas --> <canvas class="myCanvas" style="user-select: none;" id="myCanvas-Modal" touch-action="none">
  3. @Deltakosh @Dad72 Hey guys, both of your methods worked. I found the problem for me that I am using an older version v3.0 from Balylon-master. I think onMaterialChangedObservable only available in Balylon v3.1-alpha. I switched to v3.1-alpha now. It worked. Cheers!
  4. Thank you, Deltakosh. I kind of understood what you were doing right here. I tried to listen to the change from the material with my mesh m, but nothing happened. modelGoldTop.onSuccess = function (task) { m = task.loadedMeshes[0]; m.onMaterialChangedObservable.add(function(){ console.log("Material loaded"); }); }; Is there any documentation for this?
  5. Hi Guys, I am Juncheng. I am new to Babylon.js. I imported a model through OBJ loader, then I failed to modify the properties of its material. modelGoldTop.onSuccess = function (task) { m = task.loadedMeshes[0]; m.scaling = new BABYLON.Vector3(12,12,12); var material = m.material; console.log("Material: " + material); // material.backFaceCulling = false; // m.material = material; console.log(m); } I tried to log the material and mesh object. The material shows undefined, but if you dive into the mesh, you can find the mesh has its material. Why? I am confused. How to edit the material?