-
Content Count
100 -
Joined
-
Last visited
About pichou
-
Rank
Advanced Member
Profile Information
-
Gender
Male
-
Location
Paris
Contact Methods
-
Twitter
PichouPichou
Recent Profile Visitors
1652 profile views
-
pichou changed their profile photo
-
pichou reacted to a post in a topic: How to move the mesh direction in camera relate rotation and position?
-
-
Creating and displaying mesh from GeoJSON coordinates
pichou replied to Treant's topic in Questions & Answers
Here is the functions I created to draw world border lines from a geojson file around a 3D sphere in https://wazana.io : addWorldLines () { $.getJSON("yougeojsonfileurl", (data) => { let features = data.features; for (let i = 0; i < features.length; i++) { let geo = features[ i ].geometry; let coord = geo.coordinates; if (geo.type == 'Polygon') { this.buildLine(coord); } else { for (let j = 0; j < coord.length; j++) { this.buildLine(coord[j]); } } } this.setStyle(); }); } worldLines = []; buildLine (coord:Array<any>) { let gradient = BABYLON.Color3.FromHexString(Colors.gradient); for (let i = 0; i < coord.length; i++) { let poly = coord; let babylonGeo = []; for (let i = 0; i < poly.length; i++) { let pos =this. getVectorFromLatlng(poly[1], poly[0], this.radius); babylonGeo.push(pos); } let line = BABYLON.Mesh.CreateLines('sbline'+i, babylonGeo, this.scene); line.parent = this.sphere; line.isPickable = false; line.color = gradient; this.worldLines.push(line); } } -
-
-
-
-
Hummmmmmm Okkaayyyyyyyy! 😅 I haven't read the document carefully enough. Sorry I did not understand we had to add autoRotationBehavior property. Thanks! Perhaps that could be more obvious in the documentation? @Deltakosh Can you tell me how to make a PR on the documentation please?
-
Not sure if it's a bug but it seems like camera property idleRotationWaitTime is not working. Look at this playground, whatever the time you put, it always wait 2-3 seconds before starting moving again : https://www.babylonjs-playground.com/#6FBD14#75
-
-
Hi everyone, I come here to share with you something While working on a project, I had issues because of the maxSimultaneousLights for a material. Indeed my scene can have a lot of lights. Rather than increasing the maxSimultaneousLights parameter, I thought it would be more performant to check what was the mesh around the light depending on its range. So I ended up with this code : checkIncludedMeshes () { let includedContent = []; for (let i = 0; i < scene.meshes.length; i++) { let mesh = scene.meshes[i]; if (mesh.absolutePosition) { let dist = BABYLON.Vector3.Distance(this.light.absolutePosition, mesh.absolutePosition); if (dist < this.light.range) includedContent.push(mesh); } } this.light.includedOnlyMeshes = includedContent; } But then I ask myself: "Why is it not the default light behaviour in BABYLONJS?" I guess there would be performance issues doing that. Anyway, I wanted to have your opinion on this and I thought that could help the community!
-
Creating and displaying mesh from GeoJSON coordinates
pichou replied to Treant's topic in Questions & Answers
Most of the time geoJSON are made of latitude/longitude coordinates which you can easily translate to babylonJS Vector3 with this function : let getVectorFromLatlng = (lat:number, lng:number, radius) => { var phi = (90-lat)*(Math.PI/180), theta = (lng+180)*(Math.PI/180), x = (radius) * Math.sin(phi)*Math.cos(theta), z = (radius) * Math.sin(phi)*Math.sin(theta), y = (radius) * Math.cos(phi); return new BABYLON.Vector3(x/3, y/3, z/3); } -
A lot of very nice feedback since WAZANA.IO is featured on the BABYLONJS homepage. I suspect you guys to help me make this game even better! Huge thanks
-
-
-
Hi @ssaket, I needed to keep my latitude longitude approach but thanks to your suggestion, I managed to get the right formula: https://www.babylonjs-playground.com/#VDG184#9 Thanks, I didn't know about the alignWithNormal function but very useful! Cheerz
-
I am sure the problem is already solved somewhere and well known but I can't find a working solution. I have a sphere with planes around it and I need those planes to be tangent to the sphere depending on its position. I have made a playground with my basic setup: https://www.babylonjs-playground.com/#VDG184#2 You will see 2 solutions I tried but which are not working, one using path3D and one with basic math. Thank you, Pichou
-
-
Ok I know how to do it then. But that means I will have to load the files twice and I don't want to do that both for the servers and clients. Guess I will find another way! Thanks for your help @Deltakosh
-
When I go to my network console and look at the headers, there is always the Content-Length. Maybe there is a way to get the xhr of a task in the assetManager? This way I could calculate the weight I am looking for?
-
Hum I see! I found we could get the length with the xhr like this : ```parseInt(xhr.getResponseHeader("Content-Length"))``` if you already use it for the progress, I guess we can also have it somehow when the loading is finished? If some task/file doesn't have Content-Length indicated by the server it is ok because the result I want doesn't have to be exact.
-
Nope to be more specific, the exact thing I am looking for is to know the entire scene weight. Meaning what is the total of data in bytes that need to be loaded in order to render the scene. So after everything has been loaded and not during the progress. Maybe a way to reach the "Content-Length" header of each asset request?
-
Hello babylonjs community, Is there a way to have the file weight uploaded with the assetManager whatever the type of file? Cheerz, Pichou
-
Sorry @Deltakosh I haven't seen you asked for a screenshot. I even have a better stuff illustrating the game for you (hope this is not too late) :
-
-
Very nice simulation! Indeed it hasn't change much my computer performance eventually. I think this is more my curiosity which has pushed me to ask!