Popular Content

Showing content with the highest reputation on 07/10/2018 in all areas

  1. 3 points

    TYPESCRIPT in Playground

  2. 3 points

    TYPESCRIPT in Playground

    Ok Folks here we are: https://www.babylonjs-playground.com/ts.html Let me know how you feel about it
  3. 1 point
    PR submitted - https://github.com/BabylonJS/Babylon.js/pull/4722
  4. 1 point

    Align / Center Text

    align property is used only on multi-line text, so you can remove that. To recenter you do have to set the x anchor after you change your text (because the width of the text changes), like this: this.countdownTxt.setText('9'); this.countdownTxt.anchor.x = this.countdownTxt.width / 2;
  5. 1 point
    Thanks a lot guys..!!! I really appreciate this..!!! 🙏
  6. 1 point

    Physics Examples

    As always amazing response speed and fix @enpu keep up the awesome work!
  7. 1 point
    I think each mesh requires as many draw calls as it has subMaterials, which would explain the huge draw calls count. Any hint about what you are trying to render ? A full city ? A very detailed building ? The easiest way to improve performances would be -> Freeze meshes not moving. If a mesh only move "sometime" (on user input for example), keep it frozen when it's not. There's some true optimization here, if not done already. -> Merge meshes sharing materials together, you will reduce the draw calls count, also some true optimization. It's harder, but you will also need some LOD and / or baking into texture, because I'd say your triangle count is way too high... Everything's here : https://doc.babylonjs.com/how_to/optimizing_your_scene Good luck !
  8. 1 point

    Dynamic DDS files

    You have the right Base64. I've created a PG that works for me: https://playground.babylonjs.com/index.html#JPMIF9
  9. 1 point

    Physics Examples

    @8bitdna Good find, thanks! I have now fixed this and updated p2.js plugin to version 1.2.1
  10. 1 point

    Using typescript in playground

    Thanks a lot @NasimiAsl!!
  11. 1 point

    exploring matrix multiplications

    the next day (use mousewheel, if you able to) https://www.babylonjs-playground.com/#SQP9E0#5
  12. 1 point

    Reshape SpotLight with a texture

    I had the same idea as Wingnut, so not sure if you are after that same effect done another way (look up): https://www.babylonjs-playground.com/#X3XD2C#3
  13. 1 point

    Reshape SpotLight with a texture

    Hi guys. http://www.babylonjs-playground.com/#1Z89KY#13 Wingnut goofin' around. This requires shadowGenerator. I can't make transplane2.visibility = 0, though. Not so far. Essentially, I'm shining light thru an inverse cookie-cutter. Kludge. This is probably not helpful, but I thought I should show it. Note: This PG was contributed-to... by many people. Line 44 - mat2trans.anisotropicFilteringLevel = 0; ...is not understood by me. Future users may wish to investigate its use/need.
  14. 1 point
    This topic is worth a read
  15. 1 point
    Here's a PG that has a 'roof' added: http://www.babylonjs-playground.com/#4GBWI5#90 However, depending where you are in the world, a roof could be one of many types; flat, pitched, hipped etc.
  16. 1 point
    Cool wall-generator code, Thamali! You are driving BJS/JS quite well... considering you are "new". Thx for providing that useful playground demo. @dbawel... squares/rectangles... I could MAYBE help-with. That "indented corner" probably makes this challenge too difficult for my simpleton brain. But, I will keep thinking and looking thru my list of playgrounds. I have a strange personal issue (what's new?). It seems my brain can't code anything... until them soccer kids are removed from that cave. hmm. Sorry to hear about your internet issues, DB. First time I have ever heard about heat causing internet problems. Sucks, but interesting. I bet the ISP(s) is/are getting tons of complaints.
  17. 1 point
    @thamali You have all of the information you require in your 'buildFromPlan' function to accomplish this. Just use selected info from this function and add the roof within the function. If this isn't clear enough to you right now. then I'm certain I or someone else on this forum can modify the PG scene to demonstrate how. I'll try to get to it soon, but due to the 42C degree temperatures her right now, my internet connection is only up for a few minutes or hours at night when the temperature drops a bit. I'm expecting this to get better as the temperature should be in the 30C's tomorrow. At least I hope. @Wingnut... want to help him out? DB
  18. 1 point
    Hey losthope, I see you had some fun with the raptors You are the second person - out of two - who mentioned the trees. I'm starting to doubt that the CDN is doing a good job sending off the high-quality models fast enough... I don't see any reason why p2p WebRTC connection wouldn't work behind shared IP. If you are interested to just mess around with WebRTC to figure out whether it's for you or not, I would recommend PeerJS as a start because establishing a connection between two people is a nightmare if you want to do it yourself. PeerJS have live demos as well so you can try the shared IP issue without committing yourself. Please don't have second thoughts about contacting me if you have any other questions, and let me know if your hobby game is available for a spin
  19. 1 point
    Hi Hit2501, Well 3 solutions come to my mind: Yes you can use sprites. I would recommend to reduce the sprite locations to have a minimum distance (so they don't overlap, which isn't fancy). See the Street Hoops 3D demo on babylonjs.com when you aim the basket ball you see a trail of dots for an example. Hint: Put the Vector3 points into a Path3D to get more useful properties about the trajectory for free. You can also use the Line mesh to draw a line through the points. See https://doc.babylonjs.com/how_to/parametric_shapes#lines If you have multiple trajectories you can use the LineSystem (and give each ball line a different color etc.). Finally you can use a Ribbon or mesh extrusion along a Path3D if you want the line to have some sort 'shape' in 3D. E.g. for a ball which is a sphere your line shape will be an extruded Circle to create a (bended) tube. Demo's http://jerome.bousquie.fr/BJS/demos/rollercoaster.html see the track that is constructed along the line path. Also see the docs on extruding a shape along a path. Maybe there are more ways, but these 3 will probably help you get started. I use option #2 (for debug) an #3 for my Model Train Simulator game to construct the rail track path. Enjoy. Q
  20. 1 point
    @thamali It all depends on how you're constructing the walls representing each footprint. @Wingnut has a potential solution, but it all depends on how you're generating the geometry which you roof is dependent. DB
  21. 1 point
    Hi thamali, welcome to the forum. First, I'm going to assume that "footprint" is almost the same as "building foundation". Footprint is a good term, but might be confusing to some readers. Umm... you need to "sum" the bounding-areas of all the walls. I think there is a function nearby... which does that. I'm searching. Help needed from others, please. (I will keep looking, though.) I think, if you meshMerge all the wall meshes... then you can do... var myTapeMeasure = mergedMesh.getBoundingInfo().boundingBox; Then examine the properties on your tape measure object, and you will see some useful values. Stay tuned... better answers are nearby. Does anyone have/know-of a function that ... sums the bounding-volumes of an array of positioned mesh? Thx! Post url/info here, please.
  22. 1 point

    Playground saved scenes hosed

    Thank you guys..I was a fun wake up for me 6am: my inbox full of alerts, 2 issues created on the repo. I jumped naked from my bed to my office 6:30am: Issue seems to come from the snippet server not able to communicate anymore with our azure SQL server. 6:45am: Ok the SQL server is forcefully refusing all incoming requests. 7am: Even with no firewall, all incoming connections are rejected. Opening a ticket. I have to pay to get support. Closing the ticket 8am: My daughter woke up. I need to dress and to stop my investigation but seems related to a hard limit linked to the subscription I'm using (Free) 9am: Ok my daughter is at school, let's go back to business 9:15am: Bumping the SQL Server instance to a bigger subscription. Problem solved
  23. 1 point
    Hello, I am developing a 3d page, with babylonjs, I have the scene, that I am modeling and exporting in "blender" to a babylon file. In code I am adding shadows and lights, some of these lights I need turn on an turn off whe the lamp is clicked. I create the lights like this: //Luz global light[0] = new BABYLON.DirectionalLight("LuzGlobal", new BABYLON.Vector3(0, -1, 1), scene); light[0].diffuse = new BABYLON.Color3(1, 1, 1); light[0].specular = new BABYLON.Color3(1, 1, 1); light[0].direction = new BABYLON.Vector3(0, -1, 1); light[0].position.x = 27; light[0].position.y = 28; light[0].position.z = -89; light[0].intensity = 1.0; //createLensFlare(); //Creamos las luces de las lamparas light[1] = new BABYLON.SpotLight("lampara1", scene.getMeshByName("lamp1").position, new BABYLON.Vector3(0, -1, 0), 0.8, 2, scene); light[1].diffuse = new BABYLON.Color3(1, 1, 1); light[1].specular = new BABYLON.Color3(1, 1, 1); light[2] = new BABYLON.SpotLight("lampara2", scene.getMeshByName("lamp2").position, new BABYLON.Vector3(0, -1, 0), 0.8, 2, scene); light[2].diffuse = new BABYLON.Color3(1, 1, 1); light[2].specular = new BABYLON.Color3(1, 1, 1); light[3] = new BABYLON.SpotLight("lampara3", scene.getMeshByName("lamp3").position, new BABYLON.Vector3(0, -1, 0), 0.8, 2, scene); light[3].diffuse = new BABYLON.Color3(1, 1, 1); light[3].specular = new BABYLON.Color3(1, 1, 1); light[4] = new BABYLON.SpotLight("lampara4", scene.getMeshByName("lamp4").position, new BABYLON.Vector3(0, -1, 0), 0.8, 2, scene); light[4].diffuse = new BABYLON.Color3(1, 1, 1); light[4].specular = new BABYLON.Color3(1, 1, 1); And I switch the state like this: // Apagamos o prendemos la luz de la lampara 1 scene.getMeshByName("lamaparaCalle1").actionManager = new BABYLON.ActionManager(scene); scene.getMeshByName("lamaparaCalle1").actionManager.registerAction(new BABYLON.ExecuteCodeAction(BABYLON.ActionManager.OnPickTrigger, function (evt) { if(light[1].isEnabled() == true){ light[1].setEnabled(false); if(scene.getMeshByName("vlsT1") != null) scene.getMeshByName("vlsT1").setEnabled(false); } else{ light[1].setEnabled(true); if(scene.getMeshByName("vlsT1") != null) scene.getMeshByName("vlsT1").setEnabled(true); } })); // Apagamos o prendemos la luz de la lampara 2 scene.getMeshByName("lamaparaCalle2").actionManager = new BABYLON.ActionManager(scene); scene.getMeshByName("lamaparaCalle2").actionManager.registerAction(new BABYLON.ExecuteCodeAction(BABYLON.ActionManager.OnPickTrigger, function (evt) { if(light[2].isEnabled() == true){ light[2].setEnabled(false); if(scene.getMeshByName("vlsT2") != null) scene.getMeshByName("vlsT2").setEnabled(false); } else{ light[2].setEnabled(true); if(scene.getMeshByName("vlsT2") != null) scene.getMeshByName("vlsT2").setEnabled(true); } })); // Apagamos o prendemos la luz de la lampara 3 scene.getMeshByName("lamaparaCalle3").actionManager = new BABYLON.ActionManager(scene); scene.getMeshByName("lamaparaCalle3").actionManager.registerAction(new BABYLON.ExecuteCodeAction(BABYLON.ActionManager.OnPickTrigger, function (evt) { if(light[3].isEnabled() == true){ light[3].setEnabled(false); if(scene.getMeshByName("vlsT3") != null) scene.getMeshByName("vlsT3").setEnabled(false); } else{ light[3].setEnabled(true); if(scene.getMeshByName("vlsT3") != null) scene.getMeshByName("vlsT3").setEnabled(true); } })); // Apagamos o prendemos la luz de la lampara 4 scene.getMeshByName("lamaparaCalle4").actionManager = new BABYLON.ActionManager(scene); scene.getMeshByName("lamaparaCalle4").actionManager.registerAction(new BABYLON.ExecuteCodeAction(BABYLON.ActionManager.OnPickTrigger, function (evt) { if(light[4].isEnabled() == true){ light[4].setEnabled(false); if(scene.getMeshByName("vlsT4") != null) scene.getMeshByName("vlsT4").setEnabled(false); } else{ light[4].setEnabled(true); if(scene.getMeshByName("vlsT4") != null) scene.getMeshByName("vlsT4").setEnabled(true); } })); But the first time that i turn off the lights the scene is paused and then continue, what is the best way to do that? maybe I am doing something wrong. the complete source is: https://github.com/flelix/entorno-models.git the project path is: entorno-models/code/proyBabylon/p2/ thanks and regards
  24. 1 point

    Fastest way to display fps

    @Pryme8 - Actually, I prefer to use my own code - which as I know your skillset is most likely known to you - but for others, here's a simple method to set this up in your script. add this to your CSS file #fpsLabel { position: absolute; right: 20px; top: 20px; color: #999; cursor: default; } And set the display position wherever you like. Then in your script body, use this: engine.runRenderLoop(function () { scene.render(); var fpsLabel = document.getElementById("fpsLabel"); fpsLabel.innerHTML = engine.getFps().toFixed() + " fps"; }); I added in the runRenderLoop function just to show where to call this using the DOM. This is how the FPS is displayed on the playground, and it will not impact performance in any way. Also, you don't need to use any browser tools, and always register your FPS at will without modification to your browser. DB
  25. 0 points
    One of my customers are well known company, they are here in the forums too with good reputation. They purchased custom game and I've delivered it to them. They delayed payment with tons of explanations. Now I see my code used on their site but I haven't received any payment from them. I am going to look for legal solution. And this is a simple reminder - always get at least half in advance even if you have several projects with the same client before. And those guys have reputation, haha. My bad for being too naive.