• Content count

  • Joined

  • Last visited

About foumfo

  • Rank
    Advanced Member

Profile Information

  • Gender
  • Location

Recent Profile Visitors

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

  1. That did it! All it took was just 2 lines of code. It baffles me just how some complicated problems have such simple solutions
  2. not a problem, it's just that when it rotates anti-clockwise I'd like the value to be something like that: -Math.PI/2 is equal to 3*Math.PI/2. Unfortunately I can't explain it any other way
  3. if you rotate it anti-clockwise you'll see that it gets negative values
  4. you mean rotate it anti-clockwise right? (Or dragging the pointer to the left) player.mesh.rotation.y get's negative values like -1.1
  5. It works great thanks John! It was so simple. Everything I tried was much more complex. And another thing: when the mesh rotates anticlockwise, rotation.y's value get's reversed negative values. For example Math.PI/2*3 is -Math.PI/2. Essentially it's the same thing. Would it be possible for the rotation.y's value in this case to not be reversed?
  6. player.mesh.rotation.y = currRotationY + (evt.clientX - currPositionX) / 500.0; player.mesh.rotation.y %= 2*Math.PI ; like this right?
  7. where would this line of code fit exactly?
  8. Hey everyone I'm back! I have a mesh that rotates around the Y axis whenever I click and drag along the screen: var currRotationY = 0, currPositionX = 0, clicked = false, originalRotation; canvas.addEventListener("pointerdown", function(evt) { currPositionX = evt.clientX; currRotationY = player.mesh.rotation.y; originalRotation = player.axis.rads; clicked = true; }); canvas.addEventListener("pointermove", function(evt) { if (!clicked) return; //player.mesh is my mesh player.mesh.rotation.y = currRotationY + (evt.clientX - currPositionX) / 500.0; }); canvas.addEventListener("pointerup", function(evt) { clicked = false; }); Whenever my mesh completes a 360deg turn, its rotation.y value continues to grow beyond Math.PI*2. I'd like it to be reset to 0 whenever that happens.
  9. I see. So it's better to just leave the merged planes as it is right?
  10. Still if it can be done it's worth a shot
  11. Yeah, something like that. For example, 'merging' all duplicate vertices in a MergedMesh. Would it help in any way in terms of lighting and performance?
  12. Is there a way to merge the vertices of merged meshes ;
  13. I managed to do something like what I had in mind but I still need to achieve this using a pointLight and not a spotLight. Plus, could anyone tell how to soften the shadow's edges?
  14. I ended up using this in order to create a svg istead of using canvas: var svg = document.querySelector('svg'); var w = map.cells[0].length, h = map.cells.length; svg.setAttribute('viewbox', '0 0 ' + w * guiGen.cellSize + ' ' + h * guiGen.cellSize); for (var y = 0; y < h; y++) { for (var x = 0; x < w; x++) { if (map.cells[y][x] === 1) { var fill = 'fill:rgb(0,0,0);' } else { var fill = 'fill:rgb(255,255,255);' } var svgns = ""; var rectangle = document.createElementNS(svgns, 'rect'); $(rectangle).attr({ x: x * guiGen.cellSize, y: (h - y) * guiGen.cellSize, width: guiGen.cellSize, height: guiGen.cellSize, style: fill }); svg.appendChild(rectangle); } }
  15. I still can't get it to work in my scene: var shadowGenerator = new BABYLON.ShadowGenerator(1024, playerLight); for(i = 0; i < scene.meshes.length; i++){ if(scene.meshes[i].name != "sphere"){ scene.meshes[i].receiveShadows = true; } } shadowGenerator.addShadowCaster(wallsFinal); shadowGenerator.bias = 0.0017; light.shadowMaxZ = 100; light.shadowMinZ = 0.0001; and this when I add all the meshes as shadowCasters: The only kind of light that works surprisingly well is a spotlight, just like wingnut's example but that's not what I'm looking for: