Search the Community

Showing results for tags 'solved'.



More search options

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • HTML5 Game Coding
    • News
    • Game Showcase
    • Facebook Instant Games
    • Coding and Game Design
  • Frameworks
    • Phaser 3
    • Phaser 2
    • Pixi.js
    • Babylon.js
    • Panda 2
    • melonJS
    • Haxe JS
    • Kiwi.js
  • General
    • General Talk
  • Business
    • Collaborations (un-paid)
    • Jobs (Hiring and Freelance)
    • Services Offered

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


Website URL


Twitter


Skype


Location


Interests

Found 1,435 results

  1. jurito

    Pixel perfection

    Hello, I am trying to achieve pixel perfection in BabylonJs (ie a plane facing towards the camera with width and height lets say 100, should be 100x100px) using a simple formula ( https://github.com/mrdoob/three.js/issues/1239#issuecomment-374228203 ) I used eons ago in Papervision and later in ThreeJS but I am having some problems. I suppose it's something related to the camera settings, but I just can't pinpoint the specific issue.. Anyone did do this already? TIA
  2. Hi all, EDIT: Issue solved. See bottom of post. I am trying to use assetManager and everything seems to be fine but the onSuccess callback is called and passed a task object that has no meshes in loadedMeshes. Here is the relevant code: export default class GameAssetManager{ constructor(gameManager, gamePackage){ this.initialized = false; this.gameManager = gameManager; this.assetScene = gameManager.gameDisplay.scene;//new BABYLON.Scene(gameManager.gameDisplay.engine); this.assetsManager = new BABYLON.AssetsManager(this.assetScene); this.gamePackage = gamePackage; this.baseMeshesForCloning = {}; this.gamePackage.fleets.forEach((fleet)=> {fleet.forEach((ship)=>{this.baseMeshesForCloning[ship.shipSpec.mesh.meshID] = ship.shipSpec.mesh; })}); } initialize(){ this.GetAllMeshesForCloning(); this.assetsManager.load(); } GetAllMeshesForCloning(){ for (const key of Object.keys(this.baseMeshesForCloning)) { let mesh = this.baseMeshesForCloning[key]; //load in mesh from specified root and filename. let task = this.assetsManager.addMeshTask("mesh_" + mesh.meshID, mesh.meshID, mesh.directory, mesh.filename ); task.onSuccess = function(task) { mesh["mesh"] = task.loadedMeshes[0]; } task.onError = function (task, message, exception) { console.log(message, exception); } var textTask = this.assetsManager.addTextFileTask("text task", "build/msg.txt"); textTask.onSuccess = function(task) { console.log(task.text); } } } ) The odd part is that in my network tab in dev tools the obj files are loaded successfully and the addTextFileTask works fine. The loadedMeshes array is just empty for some odd reason. The files I am loading are here: https://raw.githubusercontent.com/WriterZephos/files/master/Fighter.obj https://raw.githubusercontent.com/WriterZephos/files/master/Fighter.mtl Any help would be greatly appreciated. EDIT: I solved the issue! I didn't realize what the meshNames argument was... though it was just giving a name to the mesh or something, but it was actually looking for a mesh by that name! Wow I am such a noob at this. Thanks.
  3. The title says it all. I have a room with PBR walls\floor\ceiling. I have a mirror on the wall and I want to make some object inside the room invisible unless you look at it through a mirror. How can I make this work using BJS?
  4. I just got a new LG K30 android phone and my project shows all surfaces as flat black without lighting. The latest chrome firefox and opera all show the same. The train demo and Cornell box demos appear fine, but every other demo with lighting that I've tried displays the same behavior (including my own project t.t) Android 8.1.0 Any insight greatly appreciated!
  5. JTerry

    GLTF Extras

    It looks like the gltf format allows for "extra" attributes to be included in the file. Below is a link to the gltf issue that talks about it and a screen shot of the gltf file after export with an extra. Does the babylonjs gltf loader pull that info in? I don't see it the mesh anywhere. Link to comment https://github.com/KhronosGroup/glTF-Blender-Exporter/issues/15 Thanks!!
  6. Hi, how do I make a UniversalCamera rotate on mouse move without the user having to click and drag on the canvas? Sorry for such a noob question, I just can't figure it out. Thanks.
  7. I NEED HELP IN Clock time Function in babylon js 3d configurator th i want to make this model watch hands Movie like Real clock and real time any one can help me i have use this code for run that functions var hrHand = document.getElementById('hrHand'); var mnHand = document.getElementById('mnHand'); var mnHand = document.getElementById('secHand'); function initClock() { var date = new Date(); var hour = date.getHours() % 12; var minute = date.getMinutes() ; var second = date.getSeconds() ; var hrDeg = 0; var mnDeg = 0; var secDeg = second * 6; hrHand.transform = 'rotate(' + hrDeg + 'deg)'; mnHand.transform = 'rotate(' + mnDeg + 'deg)'; mnHand.transform = 'rotate(' + secDeg + 'deg)'; setTimeout(initClock, 1000); }; initClock(); and my object Id is this i try all js code of clock not working any one Please help me out any one can send me the demo of clock function ?
  8. DylanD

    Fog Density

    Hello everyone, I was wondering is there a way I could use scene.fogStart and scene.fogEnd, but with the scene.fogMode = BABYLON.Scene.FOGMODE_EXP, or EXP2, where fogStart and fogEnd just changed where the fog starts to show, that way there is not hard maths involved(just a simple if(fogPos>fogstart){fog.alpha = alpha}else{fog.alpha = 0}. something like this). Im not sure how to go about this because from what I understand fog is a function in the BABYLON.Scene, which I dont think I should edit, and dont know how I could edit and still keep it in my game. So what I would like to know is, can it be done, changing the fog to the above ideas, and if it can be done how should I go about it, is changing how scenes work really the only way, would it even be as difficult as I think?
  9. 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
  10. Hello, I'm trying to create an SPS with up/down movement of the particles. What I want is to simulate the floating motion in the water. I have tried with pivot.y and Math.sin(k) with k++ but all the particles are moving as a mesh. What I want is to animate the particles randomly (i.e. some of them to move up while some others to move down and at different positions). This is what I got so far: http://playground.babylonjs.com/indexStable.html#EFRPL2 Any suggestions?
  11. freetoplay

    glTF Validation Error

    I am getting glTF validation error when I export with unlit materials. Here is what the error looks like when I load it into the BabylonJS sandbox: { "uri": "Character.glb", "mimeType": "model/gltf+json", "validatorVersion": "2.0.0-dev.2.5", "validatedAt": "2018-10-09T01:41:05.107Z", "issues": { "numErrors": 8, "numWarnings": 1, "numInfos": 1, "numHints": 0, "messages": [ { "code": "UNSUPPORTED_EXTENSION", "message": "Unsupported extension encountered: 'KHR_lights'.", "severity": 1, "pointer": "/extensionsUsed/0" }, { "code": "UNDECLARED_EXTENSION", "message": "Extension was not declared in extensionsUsed.", "severity": 0, "pointer": "/materials/0/extensions/KHR_materials_unlit" }, { "code": "UNDECLARED_EXTENSION", "message": "Extension was not declared in extensionsUsed.", "severity": 0, "pointer": "/materials/1/extensions/KHR_materials_unlit" }, { "code": "UNDECLARED_EXTENSION", "message": "Extension was not declared in extensionsUsed.", "severity": 0, "pointer": "/materials/2/extensions/KHR_materials_unlit" }, { "code": "UNDECLARED_EXTENSION", "message": "Extension was not declared in extensionsUsed.", "severity": 0, "pointer": "/materials/3/extensions/KHR_materials_unlit" }, { "code": "UNDECLARED_EXTENSION", "message": "Extension was not declared in extensionsUsed.", "severity": 0, "pointer": "/materials/4/extensions/KHR_materials_unlit" }, { "code": "UNDECLARED_EXTENSION", "message": "Extension was not declared in extensionsUsed.", "severity": 0, "pointer": "/materials/5/extensions/KHR_materials_unlit" }, { "code": "UNDECLARED_EXTENSION", "message": "Extension was not declared in extensionsUsed.", "severity": 0, "pointer": "/materials/6/extensions/KHR_materials_unlit" }, { "code": "UNDECLARED_EXTENSION", "message": "Extension was not declared in extensionsUsed.", "severity": 0, "pointer": "/materials/7/extensions/KHR_materials_unlit" }, { "code": "NODE_EMPTY", "message": "Empty node encountered.", "severity": 2, "pointer": "/nodes/9" } ], "truncated": false }, "info": { "version": "2.0", "generator": "babylon.js glTF exporter for 3ds max 2017 v1.2.40", "extensionsUsed": [ "KHR_lights" ], "resources": [ { "pointer": "/buffers/0", "mimeType": "application/gltf-buffer", "storage": null }, { "pointer": "/images/0", "mimeType": null, "storage": "bufferView" }, { "pointer": "/images/1", "mimeType": null, "storage": "bufferView" }, { "pointer": "/images/2", "mimeType": null, "storage": "bufferView" }, { "pointer": "/images/3", "mimeType": null, "storage": "bufferView" } ], "hasAnimations": false, "hasMaterials": true, "hasMorphTargets": false, "hasSkins": false, "hasTextures": true, "hasDefaultScene": true, "primitivesCount": 9, "maxAttributesUsed": 3 } Does anyone know what's going on?
  12. Hello, I found a problem with moving shadows. If I create a box with shadows, it is perfect, but if the object, a moment later, is in motion, the shadow of the first box will shake and degrade sharply. Observe the shadow for 10 to 20 seconds and see how it gets worse after the second box is started moving. http://www.babylonjs-playground.com/#U8MEB0#9
  13. Hello! My scenario: - An OBJ file containing several meshes (cube, cones, monkey head, etc) all touching each other - A sphere (or more than one) created off to the side of the imported mesh. My objectives are: - Determine the closest point on the imported mesh from the sphere. - Create another Sphere at that point. The end result is a sphere on the surface of the imported mesh. Before I started playing with Babylon JS, I had tried Three JS. I found a small routine that would do this. Now I'd like to do the same thing in Babylon. Here's the Three JS. // This function is called first. it accepts datapoint as a parameter. datapoint is the sphere that is off to the side of the imported model. function updateClosestPointPosition(datapoint) { var p = datapoint.position; var geom = partmodel.geometry; // cone.geometry var closestDistance = 1e9; // Don't understand 1e9 to be honest var closestFace = geom.faces.forEach(function (face) { var normal = face.normal; var va = geom.vertices[face.a]; var vb = geom.vertices[face.b]; var vc = geom.vertices[face.c]; var pd = normal.dot(p.clone().sub(va)); // move p -(pd - td) units in the direction of the normal var proj = p.clone().sub(normal.clone().multiplyScalar(pd)); // closest point of proj and the triangle var cp = closestPointToTriangle(proj, va, vb, vc); if (cp.distanceTo(p) < closestDistance) { closestDistance = cp.distanceTo(p); closestPoint.position.copy(cp); closestPoint.position.y.toString() + ',' + closestPoint.position.z.toString() + ','; } }) function sameSide(p1, p2, a, b) { var ab = b.clone().sub(a) var ap1 = p1.clone().sub(a) var ap2 = p2.clone().sub(a) var cp1 = new THREE.Vector3().crossVectors(ab, ap1) var cp2 = new THREE.Vector3().crossVectors(ab, ap2) return cp1.dot(cp2) >= 0 } function pointInTriangle(p, a, b, c) { return sameSide(p, a, b, c) && sameSide(p, b, a, c) && sameSide(p, c, a, b) } function closestToSegment(p, a, b) { var ab = b.clone().sub(a) var nab = ab.clone().normalize() var n = nab.dot(p.clone().sub(a)) if (n < 0) return a if (n > ab.length()) return b return a.clone().add(nab.multiplyScalar(n)) } function closestToSides(p, sides) { var minDist = 1e9 var ret sides.forEach(function (side) { var ct = closestToSegment(p, side[0], side[1]) var dist = ct.distanceTo(p) if (dist < minDist) { minDist = dist ret = ct } }) return ret } function closestPointToTriangle(p, a, b, c) { // if the point is inside the triangle then it's the closest point if (pointInTriangle(p, a, b, c)) return p // otherwise it's the closest point to one of the sides return closestToSides(p, [[a, b], [b, c], [a, c]]) } Is there an easy way to do this in babylon js or do i need to work on some conversion? Here's the playground I started: https://www.babylonjs-playground.com/indexStable.html#NSSAV4 The playground uses two spheres. Unfortunately I am not sure how to do this offhand. Thank you for the assistance!
  14. I searched the babylon.d.ts and cannot find keyword AdvancedDynamicTexture or GUI. Does any one know how to create AdvancedDynamicTexture using TypeScript? Or where is the correct place to get the latest definition file for babylon.js? https://raw.githubusercontent.com/BabylonJS/Babylon.js/master/dist/preview release/babylon.d.ts Solution: https://raw.githubusercontent.com/BabylonJS/Babylon.js/master/dist/preview release/gui/babylon.gui.d.ts
  15. When I add Highlight layer to my mesh, then i got error: " Cannot add an uniform after UBO has been created" PG with error: https://www.babylonjs-playground.com/#TUNZFH#17 -> when you click run next time, then console do not generate errors. When I remove mesh "leatherHelm" then I can open PG without error https://www.babylonjs-playground.com/#TUNZFH#19.
  16. Hello😊 I notice when I look at my landing page on my laptop I can see everything (dropdown menu and rotating mesh) but on phone I can't see my dropdown menu at the top of my page...wondering why is this so and what can I do to change this. πŸ’–πŸ’–, Mekaboo
  17. Refer to the link below, it looks like that the fatness of the font will be impacted by the width & height of the plain mesh. This is not what I expected. Actually I want the font be rendered normally no matter what the mesh size is. Is there way to fix this issue? How to calculate an appropriate size to make the font look better? https://www.babylonjs-playground.com/#YFRMAK#11 Solution: https://www.babylonjs-playground.com/#YFRMAK#15
  18. oschakravarthi

    Showing lights physically

    Hi, When we place lights in our scene, the lights are not visible but their lighting is visible. I want to show light the light also and write code in such a way that when the user clicks on the light, the light should be switched off. Is there any built-in functionality sometjing like, myLight.renderAsMesh=true or mYLight.mesh=someLightMesh; Thanks in advance.
  19. Dear Developers, i have the following Error after updating from 3.2.0 BayblonJS to 3.3.0: ERROR in node_modules/babylonjs/babylon.d.ts(8665,5): error TS2717: Subsequent property declarations must have the same type. Property 'leftBounds' must be of type 'number[]', but here has type 'Float32Array | number[]'. node_modules/babylonjs/babylon.d.ts(8666,5): error TS2717: Subsequent property declarations must have the same type. Property 'rightBounds' must be of type 'number[]', but here has type 'Float32Array | number[]'. I have no idea to fix that, seems it is a error in the type definition? Link to the project: https://github.com/JohnnyDevNull/ng-babylon-template EDIT: Ok downgrade to 3.2.0 also doesn't work... don't know how this compiled before...
  20. TomaszFurca

    New version of BJS camera error

    Hi, last time i post three bugs. Today i want to start with develop next features to my game. Begin from update babylon to latest version. On stable version my game works, but on 4.0 alpha i got error after load scene. Stack trace: babylon.max.js:7723 Uncaught TypeError: Cannot read property 'm' of undefined at Matrix.multiplyToRef (babylon.max.js:7723) at Mesh.TransformNode.computeWorldMatrix (babylon.max.js:20641) at Scene._evaluateActiveMeshes (babylon.max.js:28963) at Scene._renderForCamera (babylon.max.js:29064) at Scene._processSubCameras (babylon.max.js:29146) at Scene.render (babylon.max.js:29344)
  21. I'm trying to build a scene with multiple cameras, of multiple types. What I find is that when I move one camera it causes all the other cameras to move too. Is there a way to prevent this? Simple example: https://playground.babylonjs.com/#U0AE2U#2
  22. Hi, In VR mode, I want to show a 3D GUI panel to the user when he clicks on a mesh. The user clicks on one of the buttons from that panel. Then the panel will be disappeared and the user will continue with his journey. I have few questions and confusion here. 1. Is using 3D Panel a right choice? 2. If the mesh the user clicks on is very close to the user, or the mesh is in a corner, there will not be much space for the 3D panel to be shown. other meshes in the scene will overlap with the 3D panel. Moreover, if a light is there in that position, the panel will get glare. So, everything else in the scene should be invisible while the panel is visible. How can I achieve this? Having panel in a different scene and toggling between these scenes is a good option? How can I toggle scenes in VR mode? From a VR scene, When I switch to the other scene, the other scene should continue in VR mode only. 3. I am experiencing a weird behavior with 3D Panel in VR. The moment I instantiate a 3D panel or 3D manager, my scene is becoming very big. I mean, assume that I am in a room. when I instantiate a 3D panel or 3D manager, the room becomes very big. I too become very big like a giant. My feet are 10 feet above the floor. Overall the entire environment is scaled 2 times. Any clue? Please guide me. Thanks in advance.
  23. freetoplay

    Swapping texture issue

    I am trying a texture for the eye of my character using the following code: const changeEyeColor = function(e) { scene.meshes[2].material.albedoTexture.dispose(); scene.meshes[2].material.albedoTexture = new BABYLON.Texture("eye2.png", scene); } However the result is this: The texture that I want to swap in is: What am I doing wrong here?
  24. Hi.Short question Can we apply displacementMap to an importedMesh? I'm already haveing bump map on material I tried something, without succes. http://playground.babylonjs.com/#K2ES59 ps: I would like to have this feature. Thanks
  25. Refer to the playground url below, sprite is in front of the sphere, however the click / pick event triggered on backend sphere first regardless of the sprite's position. Url: https://www.babylonjs-playground.com/#9RUHH#29 Expected result: Player clicked will be triggered instead of Sphere clicked.