# foumfo

Members

82

• Rank

• Gender
Male
• Location
Greece

## Recent Profile Visitors

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

1. ## Reseting a mesh's rotation after a full circle

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. ## Reseting a mesh's rotation after a full circle

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. ## Reseting a mesh's rotation after a full circle

https://playground.babylonjs.com/#LFMEFD if you rotate it anti-clockwise you'll see that it gets negative values
4. ## Reseting a mesh's rotation after a full circle

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. ## Reseting a mesh's rotation after a full circle

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. ## Reseting a mesh's rotation after a full circle

player.mesh.rotation.y = currRotationY + (evt.clientX - currPositionX) / 500.0; player.mesh.rotation.y %=﻿ 2*Math.PI ; like this right?
7. ## Reseting a mesh's rotation after a full circle

where would this line of code fit exactly?
8. ## Reseting a mesh's rotation after a full circle

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. ## Prevent light from escaping through planes/meshes

I see. So it's better to just leave the merged planes as it is right?
10. ## Prevent light from escaping through planes/meshes

Still if it can be done it's worth a shot
11. ## Prevent light from escaping through planes/meshes

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. ## Prevent light from escaping through planes/meshes

Is there a way to merge the vertices of merged meshes ;
13. ## Prevent light from escaping through planes/meshes

https://playground.babylonjs.com/#M6HJ3P#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. ## GUI glitch while adding multiple rectangles

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 = "http://www.w3.org/2000/svg"; 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); } }