joeBImagine

Members
  • Content count

    27
  • Joined

  • Last visited

  1. Something missing in the Sky Material

    @Deltakosh wow so disappointed in myself right now, I did not . I took the doc as gospel and didn't think to add that. How do you all make it look so easy?! and thank you!
  2. I am under the suspicion that there is something I am missing in the Sky material. I am able to use the sky material in the playground as depicted in this link: https://www.babylonjs-playground.com/#ZU3JQZ#5 I also followed this doc link to the T: https://doc.babylonjs.com/extensions/sky However when I download the code, and run it on a local server, it is nothing but a blank screen. Any thoughts?
  3. @brianzinn thank you for that, looks like I was doing it wrong. But I did with your last tidbit and some tweaking, get it to work properly: //CREATE THE HIGHLIGHT LAYER let h1 = new BABYLON.HighlightLayer('hl', scene); //SET THE INITIAL STATE OF THE lastClickedMesh var let lastClickedMesh = null; let mesh = null; //ADD A POINTERDOWN OBSERVABLE scene.onPointerObservable.add(evt => { if (evt.pickInfo.hit && evt.pickInfo.pickedMesh !== undefined) { //STORES THE MESH INTO A VARIABLE mesh = evt.pickInfo.pickedMesh; let fabrics = document.querySelectorAll('.fabrics'); let currentFabric; fabrics.forEach(function(fabric) { fabric.addEventListener('click', evt => { console.log(obj[evt.target.id]); currentFabric = obj[evt.target.id]; if(mesh && currentFabric){ mesh.material = currentFabric; //console.log(evt.pickInfo.pickedMeshmesh); }else { mesh.removeMesh(mesh); } }); }); //HIGHLIGHTS THE CURRENT SELECTION if (newMeshes) { if (lastClickedMesh !== null) { h1.removeMesh(lastClickedMesh); } lastClickedMesh = mesh; h1.addMesh(lastClickedMesh, BABYLON.Color3.FromHexString('#4c90ef')); } } else { h1.removeMesh(lastClickedMesh); } }, BABYLON.PointerEventTypes.POINTERDOWN); } ); I can't emphasize enough how awesome this community is :D!!
  4. I think I understand what you are saying. change my window.addEventListener ('canvas') to this: canvas.addEventListener('pointerdown', () =>{ }
  5. @Arte @brianzinn Forgive the delay in a response!! So I've set the selectedMesh as a global variable above my main function. But still not able to change textures. I think it may be something to do with the window.addEventListener(canvas,..) as now I am not able to generate console.log reports when I select the mesh but I am not certain with my limited knowledge. Updated github.
  6. Thank you for the suggestions @brianzinn. If I am understanding correctly you are saying this correct: window.addEventListener(canvas, () => { const pickResult = scene.pick(scene.pointerX, scene.pointerY); console.log(pickResult.hit); let selectedMesh = null; if (pickResult.hit === true) { selectedMesh = pickResult.pickedMesh; if (selectedMesh && currentFabric) { selectedMesh.material = currentFabric; } } console.log(selectedMesh); console.log(currentFabric, 'currentMesh'); }); If I am inputting that correctly, the texture change no longer works.
  7. @JohnK You know what, you are right. It works on my ipad correctly as well. Never thought to try that. However on desktop , in both chrome and edge the issue persists.
  8. Hello Babylon community!! I am having an issue that I am not sure how to resolve. Here is my github.io to get a better sense of the problem: https://jbimagine.github.io/# In the link above I have a babylon file loaded, and in the side ui (if you click on the gear icon) several texture HTML DOM elements. What I am trying to do is when you click on the mesh, then click on the texture swatch in the ui, the texture on the mesh will change. For some reason however, it is not working correctly. I click on the mesh, then click on the swatch, then have to click back on the mesh for the texture to actually change. Note that I am not using the set name of the mesh, but rather a const created from the pick.result so that it will be based off of any loaded mesh. Any help on what I am missing (probably something stupid easy) would be awesome! Also I am curious if it would have been easier, and more efficient to use the gui?
  9. @Wingnut you asked what am I working on!! So I will share in the wingnut chronicles!! I am currently working on a babylon prop loader and texture changer. As I love 3d, and have had a desire to get better with my javascript (and a desire to move to the web team ), I thought learning babylon and Javascript at the same time would be an awesome endeavor. Couldn't do it without this awesome community however. As they say sharing is caring, so my source code is here: https://github.com/jbimagine/Babylon1 and a live demo here: jbimagine.github.io. It is still very much a work in process, and extremely rough around the edges.
  10. @Wingnut that is good to know! And I finally figured out how to mark the thread solved hahaha!! I will let you know what I am working on over at the Wingnut Chronicles!!
  11. Babylon exporter for Maya ?

    @dsman would exporting from maya to blender work as an interim solution? As they have a Babylon exporter for blender.
  12. @Wingnut you are awesome thank you!! You all make it look so easy!!
  13. @brianzinn That is awesome thank you! Quick question, is there also a way to deselect the sphere if you click on the scene itself, in the same vein that applications like 3ds max, blender, etc work? Or would that be difficult as clicking in the scene is currently only mouse click and drag.
  14. Hello BabylonJs peeps!! I am currently able to select and deselect a mesh using actions and triggers as seen in this included playground: http://www.babylonjs-playground.com/#WG9OY#9. I am curious however if there is a way to deselect the mesh if you click anywhere in the scene or even on another mesh Also when I create the same code using an array of meshes, I get errors. I thought wrapping the solution into a for loop would work, but alas I think I am missing something. for (i = 0; i < newMeshes.length; i++) { //select the meshes in the scene newMeshes[i].actionManager = new BABYLON.ActionManager(scene); var hl1 = new BABYLON.HighlightLayer("hl1", scene); const action1 = new BABYLON.ExecuteCodeAction( BABYLON.ActionManager.OnPickTrigger, () => { hl1.addMesh(newMeshes[i], BABYLON.Color3.White()); } ); const action2 = new BABYLON.ExecuteCodeAction( BABYLON.ActionManager.OnPickTrigger, () => { hl1.removeMesh(newMeshes[i]); } ); newMeshes[i].actionManager.registerAction(action1).then(action2); }
  15. Issue with BABYLON.SceneLoader.Load

    const newMeshes = newScene.meshes; newMeshes[0].scaling = new BABYLON.Vector3(0.1, 0.1, 0.1); newMeshes[0].position.y = 0; Mr_Pinc you were right. newScene.meshes worked, than you for the help!!!