• Content count

  • Joined

  • Last visited

  1. L shaped mesh creation using ribbon

    @jerome : Awesome....exactly what i wanted. thanks a lot
  2. L shaped mesh creation using ribbon

    @jerome: Hi Jerome. I wanted to create L shaped room and shade inner area. something like this But getting a weird shape. here is the link to playground
  3. Hello everyone. I am trying to create and L shaped and inverse L shaped room structure using paths that connects 6 points. The path array is passed to ribbon function. however i am not getting the desired result. Here is the code for same: function drawRoomType2() { var mat = new BABYLON.StandardMaterial("mat1", scene); mat.alpha = 1.0; mat.diffuseColor = new BABYLON.Color3(0.5, 0.5, 1.0); mat.backFaceCulling = false; var sideO = BABYLON.Mesh.DEFAULTSIDE;; var pathArray = []; var subPath1 = []; for (var i = 10; i < 100; i++) { subPath1.push(new BABYLON.Vector3(i, 2, 11)); } pathArray.push(subPath1); var subPath2 = []; for (var i = 11; i < 99; i++) { subPath2.push(new BABYLON.Vector3(100, 2, i)); } //subPath2.push(new BABYLON.Vector3(100, 2, 11)); //subPath2.push(new BABYLON.Vector3(100, 2, 99)); pathArray.push(subPath2); var subPath3 = []; for (var i = 100; i < 50; i--) { subPath3.push(new BABYLON.Vector3(i, 2, 99)); } //subPath3.push(new BABYLON.Vector3(100, 2, 99)); //subPath3.push(new BABYLON.Vector3(50, 2, 99)); pathArray.push(subPath3); var subPath4 = []; for (var i = 99; i < 49; i--) { subPath4.push(new BABYLON.Vector3(50, 2, i)); } //subPath4.push(new BABYLON.Vector3(50, 2, 99)); //subPath4.push(new BABYLON.Vector3(50, 2, 49)); pathArray.push(subPath4); var subPath5 = []; for (var i = 50; i < 10; i--) { subPath4.push(new BABYLON.Vector3(i, 2, 49)); } //subPath5.push(new BABYLON.Vector3(50, 2, 49)); //subPath5.push(new BABYLON.Vector3(10, 2, 49)); pathArray.push(subPath5); var subPath6 = []; subPath6.push(new BABYLON.Vector3(10, 2, 49)); subPath6.push(new BABYLON.Vector3(100, 2, 11)); pathArray.push(subPath6); var mesh = BABYLON.Mesh.CreateRibbon("ribbon", pathArray, false, false, 0, scene, true, sideO); mesh.material = mat; }
  4. Thanks a lot for quick reply jerome. i can add the 4 points instead of three here. What other shape should be a good option for 3 points?
  5. Hi Team, I am creating arrows using ribbon Using material, I am trying to set the color to the arrows. however i am failing here. what am i missing?
  6. Announcing Babylon.js v3.0

  7. dashed lines in grid

    @NasimiAsl Hi Nasimi. Thanks for the demo I am not aware how syntax for Fragment_Before_FragColor works. But ill look into this. But there is lots of flickering when the above lines are viewed from longer distance.
  8. dashed lines in grid

    Hi @JCPalmer Thanks for quick reply. i tried setting both the properties from 0.1 to 100. But no luck. Here is the demo for same
  9. Can we set lines as dashed in grids lines. I am using below code: var gridBox = BABYLON.MeshBuilder.CreateBox("box1", { width: objectProperties.width, height: 0.05, depth: objectProperties.height, updatable: true }, scene); var defaultGridMaterial = new BABYLON.GridMaterial("default", scene); defaultGridMaterial.majorUnitFrequency = 2; defaultGridMaterial.gridRatio = 2; gridBox.material = defaultGridMaterial; gridBox.material.diffuseColor = new BABYLON.Color3(1, 2, 0);
  10. Flickering in custom mesh

    Hi @Wingnut, Thanks a lot for quick response(as always) I was going to optimize the code(based on some quality checkpoints that i have already listed down) once i am done with achieving the functionality. That is the reason for all this mess. and i apologize for sharing such messed up code. I am trying to improvise on all the checkpoints that you have mentioned here. 1) For windows, I am trying to create a custom mesh. using vertices and faces. instead of using 6-8 sub meshes. I hope they will help in eliminating the flickering problem. 2) for green slots(non shear walls), some edges are still flickering. though they have not collided with the other meshes. why so? 3) In one of the thread, you have discussed about using 2d lines as borders for boxes. I had hard time implementing that.l failed to scale such lines when camera is zoomed in and out. Do we have any example using meshes with 2d lines that scales down in such scenario. Thanks a lot.
  11. Hi Everyone, I am working on 2D planner. I have this demo am facing following issue: 1) As you can see i have created custom mesh (window object named w1) on top left corner of design. The code is at line 369,370. This window object have y index greater than another slot element(green slots) on top of which it lies. So there is no collision. I am aware that mesh border rendering flickers when the borders of mesh collides with each other.but i am ensuring that it is not colliding with object below it. how can i fix flickering ? 2) The text(W1) is created on top of plane having default white color. this plane hides green slots which are behind them. I have tried setting alpha property to make the plane transparent. however it is also changing transparency for text on it. How can i fix this line 138
  12. Hi Team, I have got a demo for 2D planner here DEMO 1 : The yellow box meshes are draggable horizontally and vertically(go give it a try....). Now, I wanted to prevent dragging over the places where yellow box already exist(prevent collision of yellow box). In order to do that, I have made some changes in demo 1 to implement moveWithCollisions : Demo 2(using moveWithCollisions) - Changes done: 1) Used checkCollisions and set ellipsoid(equal to width,height,depth of box) for yellow boxes: At Line : 39 - 40 box.checkCollisions = true; box.ellipsoid = new BABYLON.Vector3(sWidth, sHeight, sDepth); 2) set gravity to scene and gravity with ellipsoid to camera(not sure if this is needed as i want prevent collision among yellow boxes): At Line : 72-75 scene.gravity = new BABYLON.Vector3(0, -9.81, 0); camera1.applyGravity = true; camera1.ellipsoid = new BABYLON.Vector3(1, 1, 1); 3) enable collision for scene and camera At Line : 76-77 scene.collisionsEnabled = true; camera1.checkCollisions = true; 4) For horizontal dragging, moveWithCollisions for translating x instead of setting position.x (commented that code, line 194) : At Line : 195 currentMesh.moveWithCollisions(new BABYLON.Vector3(currentMesh.minxpos + Math.round((currentCursorXPosition - currentMesh.minxpos) / horizontalSlotWidth) * horizontalSlotWidth, currentMesh.position.Y, currentMesh.position.Z)); 4) For vertical dragging, Use moveWithCollisions for translating z instead of setting position.z (commented that code, line 201) : At Line : 202 currentMesh.moveWithCollisions(new BABYLON.Vector3(currentMesh.position.Z, currentMesh.position.Y, currentMesh.minzpos + Math.round((currentCursorZPosition - currentMesh.minzpos) / verticalSlotHeight) * verticalSlotHeight)); However, the dragging is completely gone now. what am i missing here
  13. Issue in mesh dragging

    @Gijs: awesome. exactly what i wanted. Thank you very much