Search the Community

Showing results for tags 'mesh'.



More search options

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • HTML5 Game Coding
    • News
    • Game Showcase
    • 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

Found 264 results

  1. Hi, I would like to animate a big machine and I have got some questions. The machine has got some rigid bodies (like a robot) and each other have some kinematic relations. rotation/translation ....depending on the physic axis Can I load the whole scene in blender and then export it to a babylon file or is it better to load each mesh as single components in a js file scene ? . Or any other way ? at moment, the machine comtains almost 10 meshes ,that are almost 1 to 2Mbytes stl ascii files each. Once the machine is loaded, there will be animation. The position values of each meshes are computed by a cnc post processor and the positions are available in an array for each ms. I don't know exactly how I will share these values to the babylon js model at the moment . any idea ? Regarding the vision of this project, I would need some advices on the way to implement it right in babylonjs . To give you a better overview of what I want ot achieve , here is a video of my actual project : https://drive.google.com/open?id=1OQf1YTQnIdTWPBMFzlP1J2653ZjPyVkY Regards, Steph
  2. Hi everyone hope you doing great ! I'm doing a project where I want to create complex objects from more simple or "atomic" ones. For example, I create a vertical rectangle and a horizontal rectangle, I merge them and I have a "L" shape. But when I try to merge my "L" shape with another rectangle to make a "U" for example it doesn't work :/ My question is : is there any way to do what I want to do or am I stuck with only one level of merging ? Thanks a lot for your time
  3. hi i am new to babylonjs,this is the first post i made. my problem is that i make a camera,no matter the ArcRotate Camera ,FollowCamera or ArcFollowCamera the target mesh just fixed the position in the center of the screen that is very good for lots of game however i just want to make my game the target mesh a little offset at the center of screen like :at the middle bottom left screen. or any other position i want is there a simply way or a api to make it ? thanks
  4. Extend Mesh class

    Hello, I wanted to extend the class BABYLON.Mesh with some functions, but I have problems. I created a file that does the following (extend.js): import BABYLON from 'babylonjs' import Helper from './helper.js' const {roundFloat} = Helper class Mesh extends BABYLON.Mesh { constructor () { super() console.log('check') } getMeshBounding (axis, val) { const boundingInfo = this.getBoundingInfo() // Native Bounding Info const max = boundingInfo.boundingBox.maximumWorld const min = boundingInfo.boundingBox.minimumWorld if (axis) { const value = val === 'max' ? max : min return roundFloat(value[axis]) } else { return { max: {x: roundFloat(max.x), y: roundFloat(max.y), z: roundFloat(max.z)}, min: {x: roundFloat(min.x), y: roundFloat(min.y), z: roundFloat(min.z)} } } } } export default Mesh And in the file, I want to use it (loader.js / same directory): import Mesh from './extend.js' const Loader = { loadObject: (scene, pos) => { // Create a built-in "sphere" shape; its constructor takes 6 params: name, segment, diameter, scene, updatable, sideOrientation var sphere = Mesh.CreateSphere('sphere1', 16, 2, scene, false, Mesh.FRONTSIDE) .... } } export default Loader But apparently he doesn't do it, otherwise a console.log would come. I'm relatively new to the ES2015 and Vue. Don't be too hard.
  5. Hello, Say I have ParentName > ChildName1 > ChildName2 > ChildName3, is there a quick way to have Babylon tell me the name of the ultimate parent, no matter which child I choose? I can get immediate parent using... scene.meshes[i].parent ... but I need to go right to the top. Cheers,
  6. Hi everyone, I'm just discovering BabylonJS and this is my first post ever on a forum so please be patient with me So, I'm working on a small project which consists at the moment in creating meshes via a funtion addMesh(), and I wanted to add a "selection animation" to all my meshes, basically by changing their color to an emissive white one. However, this seems not to be working, and I saw on other topics that I needed to create an actionManager for every mesh of my scene. Is there any way to make my code bellow work and have an actionManager associated to all meshes created by my function addMesh()? Here are the 2 main functions : var makeOverOut = function (mesh) { mesh.actionManager.registerAction(new BABYLON.SetValueAction (BABYLON.ActionManager.OnPointerOutTrigger, mesh.material, "emissiveColor", mesh.material.emissiveColor)); mesh.actionManager.registerAction(new BABYLON.SetValueAction (BABYLON.ActionManager.OnPointerOverTrigger, mesh.material, "emissiveColor", BABYLON.Color3.White())); mesh.actionManager.registerAction(new BABYLON.InterpolateValueAction (BABYLON.ActionManager.OnPointerOutTrigger, mesh, "scaling", new BABYLON.Vector3(1, 1, 1), 150)); mesh.actionManager.registerAction(new BABYLON.InterpolateValueAction (BABYLON.ActionManager.OnPointerOverTrigger, mesh, "scaling", new BABYLON.Vector3(1.1, 1.1, 1.1), 150)); } function addMesh() { var box = BABYLON.Mesh.CreateBox('box', 100, scene); box.position = new BABYLON.Vector3( Math.random() * 480, 50, Math.random() * 480, ); makeOverOut(box); } Thank you for you time, any suggestion would be appreciated ! ps : Sorry for my English .
  7. Mesh instance Question

    Hey everyone! Here is another demo to show that I failed to create the instance from mesh. Is something I missing? Please give me a hand, thanks!
  8. Hi, is it possible to show a timer indicator when the gaze is pointing at a plane in VR mode? Would like to do it like the video that i've attached here loading.mp4
  9. Hello everyone After a long time i am back and with something for you maybe a banal issue but for me it's a nightmare . I am trying to make little adventure game and I have issue with my charakter.babylon... when i import him to the game without skeleton everything is ok but with skeleton is wrong everything, like some parts of his clothes is missing... the console is showing me endless error lines etc. I am struggling with this 1/2 weeks . I tried everything like remake my charakter.babylon and skeleton ....I treid google, youtube ... ect. Can you guys help me ? ... sorry for my bad english . I added a photo and a blende file helpblend.rar
  10. I have simple Filter and need to make access in shader to data: - position of sprite / mesh of Stage - textureRegion rectangle info How to do this? var fragSrc = ` precision mediump float; varying vec2 vTextureCoord; uniform sampler2D uSampler; uniform vec2 dimensions; uniform vec4 filterArea; uniform vec4 texRegion; vec2 mapCoord( vec2 coord ) { return coord * filterArea.xy; } vec2 unmapCoord( vec2 coord ) { return coord / filterArea.xy; } void main() { vec2 coord = vTextureCoord; coord = mapCoord(coord) / dimensions; coord = unmapCoord(coord * dimensions); vec4 color = texture2D( uSampler, coord ); gl_FragColor = color; } `.split('\n').reduce( (c, a) => c + a.trim() + '\n' ); module.exports = RepeatRegionFilter = function RepeatRegionFilter() { RepeatRegionFilter.super_.call(this, null, fragSrc); } Util.inherits(RepeatRegionFilter, PIXI.Filter); RepeatRegionFilter.prototype.apply = function(filterManager, input, output) { this.uniforms.dimensions[0] = input.sourceFrame.width; this.uniforms.dimensions[1] = input.sourceFrame.height; filterManager.applyFilter(this, input, output); }
  11. Spine and mesh

    Hello First of all. I m so glad to see Panda on the road again :-) I have just bought the full version and playing around with Spritesheets developed in Spine 3.6.52 professional. It seems like mesh is not supported in panda 2 version 1.5.0. When I export from spine as a spritesheet with mesh animations it won´t show the spritesheet, If i remove the Mesh animation it shows the animation fine: game.module( 'game.main' ) .require( 'plugin.spine' ) .body(function() { //game.addAsset('panda.png'); game.addAsset('sheep.atlas'); game.addAsset('sheep.json'); game.createScene('Main', { init: function() { var player = new game.Player(); player.sprite.addTo(this.stage); } }); game.createClass('Player', { init: function() { //this.sprite = new game.Sprite('panda.png'); this.sprite = new game.Spine('sheep.json'); this.sprite.position.x = 200; this.sprite.position.y = 800; this.sprite.play('idle', true); } }); });
  12. Hello everyone, I have little issue with my mesh : When i load it, it get "auto smoothed", and also get "cutted" apart. Basically when I save my mesh in blender it looks like this : But when I load it with babylonjs Please help me to fix this, Thank you !
  13. Hi! I'm completely a newbie in 3D world and BabylonJs. What I'd like to do is to be able to select a given mesh by clicking on it and change it's color to show that it has been selected. I've created a really basic scene with 2 meshes and googled my problem but couldn't find anything about that. Maybe it's super trivial (?) Here's my example, thanks for any help or any useful resource to get started on this task https://playground.babylonjs.com/#TC2K69
  14. Hi ! I am trying to set 2 different textures _by code_ on a loaded mesh exported of Blender. There is no problem on "creating" a mesh from MeshBuilder and set it faceUV with options, but from a "loaded" mesh (created from blender, without any texture) I don't manage to do it. I give this playground for a start (my code is too complicated to put it in a playground) : https://www.babylonjs-playground.com/index.html#YYQ1LC#39 The goal : set any texture (from internet) to the loaded mesh to any face of the Dude.babylon. I tried few things like VertexBuffer.UVKind but... it should not be the way to go More details : My Blender object is a single plane : 6 vertices, 2 faces. My goal is to dynamically set different texture on each face . The wireframe show me the 2 faces but I have no idea how to set them the texture. Thanks for any help
  15. Hi ! I precise that my question is only about meshes Should we prefer to load small objects (between 0 and 10 units for example, with a high precision like 5.554) or it does not impact performance at all and we can work with huge numbers as well (10k, 100k) ? I speak about width/height of a box for example. I guess the more important things are the number of vertices/edges/facets and how impostors are used (mesh vs box), but I would like to know regardless of that, if the size of meshes matters. Same for textures : should we prefer a texture repeated 1000 times on a plane or a bigger texture repeated 10 times for example ? Thank you
  16. Hi, I am trying to rotate a mesh with a custom pivot, using setPivotMatrix function. In the sample below, the pivot (red box) "seems" to be in the right position, but the rotation done is not as expected (green and grey box should be superposed on the corner). I dont understand the setPivotMatrix http://www.babylonjs-playground.com/#4FNAXM#2 Why the pivot point (red box) is not inside the green box in this sample ? I just would like something like : X X [X] X X X Where [x] is the superposed part of the 2 meshes. Thanks
  17. Hello, I have several meshes on paths, and need to begin particle animations at specific locations on the paths. However, when I use the position of an object or child on the path to start the particle animation, the condition is never met. I assume that the transforms are not updated on path animations. If I start the particle animation, it starts. But if I place it in a condition, in the same location in my script, the particle animation will not start. I'm using it on the same path which @JohnK helped me with last night:: if (mesh.position.y > 0) { smokeSystem.start(); } and mesh is on the path passing above 0.0 - which I've tried every axis and the particle system will not start. If I use collisions by placing a cube on the path which my object must pass through such as: let abc = BABYLON.MeshBuilder.CreateBox(`abc`, { size: 5 }, scene); abc.position = new BABYLON.Vector3(-50, 10, 100); if (vehicle.intersectsMesh(abc, true)) { smokeSystem.start(); } The particles will not start. But if I say smokeSystem.start(); in the exact same location, the particles start. I've spent hours on this, and tried everything I know. If anyone can help, please let me know as I have to finish this tomorrow. Thanks much, DB
  18. Hello, I have a pretty complex scene built and I am having very heavy lag issues. Even though I have a lot of meshes, they are all instances of default ones... so I don't think there's any reason I should be getting only ~10 FPS. Could anyone provide me with any sort of clue as to why my performance is so low? By the way, each of those cylinders are composed of many layers of cylinders. There's usually 3 cylinders (the middle one, the border, and the outline) and under them could be at least 3 others stacked (the ones that look like shadows). Aside from that, each little "group" that you see in the screenshot has a "mapMesh" object which the cylinders are parented to. All those mapMeshes are parented to a worldMesh. For the GUI text and images, each letter/image is an instance of a previously generated text/image. Each letter is parented to a wordMesh, which is then parented to a labelMesh, which is then parented to the mapMesh or the cylinder in the case of the ones on top of it. The background with a gridMaterial has size 300 x 300 and gridRatio of 4. There's also a linear fog which starts at the end of the camera (usually 50 units apart from cylinders in the y axis) and ends at 50 units after that and has a density of 0.01. After this scene is fully generated, there isn't much coding running at all... no animations or anything, it's pretty static. However, I cannot freeze world matrices because I might need to move the cylinders. I appreciate any help, really stuck on how to improve performance here and not degrade the quality of my scene.
  19. I have a fairly complex 3ds Max model that, in 3ds Max, is grouped into a parent layer and 5 child layers. I export this to babylon format using the 3ds Max plugin and end up with dozens of separate meshes from the import. In my app I need about 300 of these models. If I parent the imported meshes to a simple box, then clone 300 times, my frame rate drops to 2-5 fps. If I merge all the imported meshes into one mesh with MergeMeshes, then use .createInstance() 300 times, my frame rate remains at 60 ftps. However, the model is now only show with texture. What's the best way to achieve 300 instances of this model, but textured properly? I've looked at MultiMaterial, but it's unclear how I'd know vertex indices. I considered looping through all the meshes in the babylon file. sorting them into meshes that use the same texture, then using MergeMeshes on those. I'd still have more meshes than is ideal. Is there a smart MergeMeshes function out there that takes care of multiple materials? Are there any other solutions that I'm missing?
  20. Displaced Shadows

    Hi guys, I recently started with some visual fidelity stuff in my scene and I wanted to add shadows. Now, I load a mesh that I exported from blender and I do this BABYLON.SceneLoader.ImportMesh("", "lib/orteclbvis/themes/defaulttheme/models/","yard.babylon", this.scene, (newMeshes, ParticleSystem, skeletons ) => { newMeshes[0].rotate(BABYLON.Axis.Y, BABYLON.Tools.ToRadians(180), BABYLON.Space.LOCAL); newMeshes[0].position.y = this.getEnvironmentHeight(); newMeshes[0].position.z = 0; newMeshes[0].position.x = 30000; if(this.sceneObjects.sunLight) { var shadowGenerator = new BABYLON.ShadowGenerator(1024*16, this.sceneObjects.sunLight); shadowGenerator.setDarkness(.3); SceneManagerHelper.enableMeshShadowsRecursively( <BABYLON.Mesh[]>newMeshes, shadowGenerator); } }); // recursive shadow enabler method code: static enableMeshShadowsRecursively(meshes : BABYLON.Mesh[], shadowGenerator : BABYLON.ShadowGenerator) { for(var i = 0; i < meshes.length; i++) { var m = meshes[i]; shadowGenerator.getShadowMap().renderList.push(m); m.receiveShadows = true; var childs = m.getChildMeshes(); if(childs && childs.length > 0) { this.enableMeshShadowsRecursively(<BABYLON.Mesh[]>childs, shadowGenerator); } } } } And my shadows are weirdly offset. See attached images. Any idea how that can happen? My scene scale is quiet big (1 babylon unit = 1mm)
  21. Hi, I am trying to load the Dude.babylon, set its position and enable physic engine in order to he collides with the ground. It is almost working : https://www.babylonjs-playground.com/index.html#YYQ1LC#35 I tried different way of loading and it change nothing. I have some problems : As soon as I add the physicImpostor, I have an error message in the console, even if the dude is loaded and displayed : BJS - [18:05:26]: Unable to import meshes from Scenes/Dude/Dude.babylon: Error in onSuccess callback As soon as I add the physicImpostor, positionning start to bug (every character are in the same place) Finaly, I have to use MeshImpostor and I would like to simplify collision with a box, but replacing MeshImpostor by BoxImpostor doesn't work, why ? How to not use MeshImpostor ? (I tryed to create parent mesh but without success) Thanks
  22. I'm trying to make my mesh smaller during its linear velocity movement. But unfortunately, as soon as I set the scaling, it stops the movement. How can I scale down my mesh in size without interrupting the movement? Is there an elegant way without having to calculate positions myself? See my example, where the movement stops after 1sec when trying to scale: http://www.babylonjs-playground.com/#5WEAFN
  23. Disposing a mesh

    Hi, On a Stackoverflow found an advice to set the mesh variable to null after the dispose call (to tell the GC he can collect). Something like: ball.dispose(); ball = null; ... is this needed nowadays or is already implemented in BJS ?
  24. Hi everyone, I know it's possible and advised to use InstancedMesh when several meshes share the same geometry and the same material. Is there some recommended optimization to do when two meshes share the same geometry but have different materials ? For example with this case : http://playground.babylonjs.com/#T4Z2V9#1 (here VertexData object is already loaded) Is there something better than two calls to "applyToMesh" ? Like obj1.geometry = obj2.geometry, this kind of thing... (my question is based on the fact that Unity explicitly share the same geometry across objects, even when Materials are different. But perhaps it's only done to optimize data packing / loading and has no impact at runtime...) (I'm fairly sure I have already found this question somewhere, but can't remember the answer nor find where it was...) Thanks a lot for your inputs ! Have a nice day,
  25. Hi, I want to create a ground mesh from a plane. let plane = new Plane(-0.4, -0.2, -0.6, 0.1); //normal and offset let planeMesh = Mesh.CreateGround("planeMesh", 100, 100, 2, scene); //to make the planeMesh to fit the plane, transformation should be added to the mesh planeMesh.rotation = ... planeMesh.positon = ... someone can help me out? Thanks.