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
    • Pixi.js
    • Babylon.js
    • Panda.js
    • melonJS
    • Haxe JS
    • Kiwi.js
  • General
    • General Talk
  • Business
    • Collaborations (un-paid)
    • Jobs (Hiring and Freelance)
    • Services Offered

Found 166 results

  1. Hello, I have noticed that there is a problem with UV mapping, if I use a dynamicTexture on my mesh, imported from .babylon file. I am sure that my mesh has proper UV mapping, I have checked it by using standard texture. If I use normal texture on this mesh, everything is ok. If I use dynamic texture on BABYLON.Mesh, everything is ok. If I use dynamic texture on my mesh, I have seen something like that: I can't find an example on the playground with a mesh with proper UV mapping, so I have chosen the skull Playground: http://www.babylonjs-playground.com/#1NQC5D#3
  2. I've exported my scene from 3Dsmax. Now I want to get individual meshes and want to do something with them. How can I select a mesh in the scene? with its name or ID... ?
  3. Hi all, I've implemented a basic-functionality of a cloner system and I'd like to hear your opinions and design/concept-suggestions for further develepment and finishing my work (if you're interested at all). I decided to use a working title "SCS" for "Simple Cloning System" and here are the core features and concepts : Cloners: given one or several meshes, either clones or instances will distributed in a specific manner. If more than one mesh is provided, the meshes are distributed alternatively. Additionally, cloners can be nested, so it is possible to clone cloners. Each cloner can have several Effectors (in particular order) to influence the Scale/Position/Rotation parameter of a clone (or cloner). A sensitivity parameter controls this influence for a cloner. Following Objects are designated: RadialCloner: radial distribution where following parameters are recognized: count, radius, offset, startangle, endangle, Effector-sensitivity for Position, Scale and Rotation, alignment-flag, orientation. LinearCloner: linear distribution where following parameters are recognized:count, offset, growth, Effector-sensitivity for Position, Scale and Rotation. An interpolation-mode-flag determines, if the clone -parameters (Scale/Position/Rotation) are interpreted as "step" or "end"-values. MatrixCloner: coming soon (clones will be distributed in 3D space) PlanarCloner: coming soon (clones will be distributed in 2D space) ObjectCloner: coming soon (clones will be distributed in relation to the internals of a given mesh (vertices, edges, triangles ...) RandomEffector: influences Scale/Position/Rotation of a clone with repeatable random values, controlled with an overall "strength" parameter. Not quite finished, but basically working. FormulaEffector: coming soon, influences Scale/Position/Rotation via text thought to control from outside (html-page). StepEffector, TimeEcffector, DelayEffector and much more ??? So, enough for the moment, you can see and play with some scenes: LinearCloner,RadialCloner,RandomEffector radial-linear-radial-cloner linear-radial-linear-cloner PS: I need some advise if I should upload the sources to github if you're interested. Should I upload it to my own github space or to BABYLONX ? If the latter, do I have to send a pull request? Sources are written in typescript
  4. I'm trying to implement double jump (one extra jump while in the air). In order for it to work also when the character is falling of a ledge or higher platform without having initiated a jump from the ground I need a way to tell if the player is currently in the air or not. How can i tell if a mesh is currently not colliding with anything? The only way I have found so far is the "intersectsMesh(mesh,precise)" function, but this requires me to check against a specific mesh. Would I need to loop through all meshes with collision in the scene to check if I am currently colliding with any of them, is there any better way to do this (seems rather inefficient). What I think I'm looking for is a "isCurrentlyColliding" value on my character mesh or perhaps it can be solved differently?
  5. In this example I set a parent to the ground and then rotate it. I would expect that the absolute position of the ground would change but it doesn't... The weirder thing is that getAbsolutePosition returns always the same vector - the vector it returned first time I called it. For instance in this example the absolute position does change according to the rotation but after I get an absolute position for the first time it doesn't change. Am I missing something?
  6. Hello! I am working on a voxel project and creating a very basic voxel player. It has a box as head, a bigger box for body, etc. I created the whole thing like this: this.player_head = BABYLON.MeshBuilder.CreateBox(PLAYER_HEAD, {size: 1, updatable: true}, scene); this.player_body = BABYLON.MeshBuilder.CreateBox(PLAYER_BODY, {width: 1, depth: 0.5, height: 1.5, updatable: true}, scene); this.player_right_arm = BABYLON.MeshBuilder.CreateBox(PLAYER_RIGHT_ARM, {width: 0.5, depth: 0.5, height: 1.5, updatable: true}, scene); this.player_left_arm = BABYLON.MeshBuilder.CreateBox(PLAYER_LEFT_ARM, {width: 0.5, depth: 0.5, height: 1.5, updatable: true}, scene); this.player_right_leg = BABYLON.MeshBuilder.CreateBox(PLAYER_RIGHT_LEG, {width: 0.5, depth: 0.5, height: 1.5, updatable: true}, scene); this.player_left_leg = BABYLON.MeshBuilder.CreateBox(PLAYER_LEFT_LEG, {width: 0.5, depth: 0.5, height: 1.5, updatable: true}, scene); // Head this.player_head.parent = this.player_body; this.player_head.position.y += 1.25; // Right arm this.player_right_arm.parent = this.player_body; this.player_right_arm.position.x += 0.75; // Left arm this.player_left_arm.parent = this.player_body; this.player_left_arm.position.x -= 0.75; // Right leg this.player_right_leg.parent = this.player_body; this.player_right_leg.position.x -= 0.25; this.player_right_leg.position.y -= 1.5; // Left leg this.player_left_leg.parent = this.player_body; this.player_left_leg.position.x += 0.25; this.player_left_leg.position.y -= 1.5; Since I need all the meshes to be treated as a single mesh, I merged them with: BABYLON.Mesh.MergeMeshes([this.player_head, this.player_body, this.player_right_arm, this.player_left_arm, this.player_left_leg, this.player_right_leg]); Until here, all beautiful and nice. But a problem arises: I want to be able to move the arms, legs and head to make some sort of animation for walking but it doesn't seem to work. My player object has the references to all the meshes before the merging, so I thought I would still be able to transform them even after the merging. What's wrong then? Also, is there perchance a better way to create a bunch of simple meshes, apply a specific material to each of them and then 'merging' them into 1 bigger BABYLON.Mesh without losing their individual texture/material? MergeMeshes destroys the materials of the children objects, which is quite bad :/.
  7. I was wondering if it's possible, and if yes, then how, to get more responsive movement when using getPositionToRef to attach a mesh to a bone assigned to some skeleton from an imported model. I think it's the same when using attachToBone. http://www.babylonjs-playground.com/#1N9CSW#2 The position and rotation of bone #6 (right hand) is used to position the sphere. Imagine it was a sword or a gun. Try moving the camera around, and notice the movement of the sphere. It seems to be a little behind, and not as crisp as one would have hoped for. Am I missing something here?
  8. Hello everyone, long time no see! So i'v ran to an issue where i'm trying to attach meshes to bones from another import. I'v this torso which is built from 2 meshes and this torso assembly holds the skeleton. Then i'v another model and when i'm trying to place the import directly to head bone for example the model flips around Z axis and goes somewhere it doesn't really belong. I'v attached an image which hopefully explains more than my english does What i'm doing wrong? any ideas? - best regards, eljuko
  9. Silly title, I know. I'm not sure how to achieve this, and I'm sure a PG is not necessary, if this functionality actually exists. Imagine the simple and common version of a FPS-setup. You have a camera, and a mesh or more in front of this camera, usually a couple of hands and a gun of some sorts. Now, when I hit a wall face-first, part of the hands/gun model will clip through the wall, and we sure don't want that to happen. Is there some way to always render the hands/gun models in front of everything else, igoring depth? I looked at z-index, renderingGroups and masks without luck.
  10. Hi, I hope someone can help me. I want to export my Blender model with the Babylon.js Blender Exporter and import it in my App. In general this works fine, but I have one problem that I can't solve. In Blender I added a parent connection between a plane and a bone of my armature. The idea is that the plane should move if the bone moves. In Blender this works fine, but not with Babylon if I import the exported scene (tried my app and the BABYLON sandbox). Now I have two problems (which may be related to each other ?) 1. The plane is in a different place in Babylon (compared to the Blender model) 2. The parent connection is not exported and if I set the connection in my app directly after the import the plane moves to a weird place (but it follows the bone) Would be nice if someone can have a look at my Blender model. In my model there are actually two planes LED.L and LED.R and a want to attach these planes to the Neck bone of my ReetiArmature. Reeti.blend Reeti.babylon
  11. I've been checking this documentation, but didn't find anything I can use. Please, help.
  12. Hi everyone! And question again How I can attach the WorldSpaceCanvas2D to some mesh on my scene? Something like WorldSpaceCanvas2D.parent = myMesh. Or I need changing a canvas position and rotation in every frame? Then next question, how I can change the WorldSpaceCanvas2D position and rotation in worldSpace? Thank!
  13. This is an issue I've had with multiple models. http://www.babylonjs-playground.com/#4CVUS#2 See how some vertex or maybe a bone has points attached to the camera? The issue seems to be with the skeleton, as removing this and the skin modifier seems to remove the issue: http://www.babylonjs-playground.com/#4CVUS#3 I'm using 3Ds Max 2015 and the Babylon.js Exporter. When uploading the file to Claro.io, the mesh and skeleton are both intact, but exporting to .babylon somehow removes the skeleton aswell. As far as I know, Clara.io uses the Blender exporter, but that's no success either. I was just wondering if anyone else has had this issue, and if yes, then maybe know a fix or a way around. Attached is the .max file for reference. simple.max
  14. Hi, i am trying to subdivide a mesh, after load it by OBJLoader on BabylonJS, but i don't understand how do something like this (ThreeJS). var geometry = new THREE.Geometry().fromBufferGeometry( mesh_.geometry ); var modifier = new THREE.SubdivisionModifier( 3 ); modifier.modify( geometry ); geometry.mergeVertices() mesh_.geometry = geometry But on Babylon JS, i could not found documentation about how subdivide polygons after load mesh by OBJLoader
  15. I am having an issue where the movement of the camera will make certain meshes disappear. The disappearing meshes are consistent, in that they are the same ones that disappear. This issue seems to happen only with the binary version. I made a playground where you can see this happening. http://www.babylonjs-playground.com/#1PFI6D All you need to do to see the behavior is walk forward with the up arrow. As you move forward you will see the frame in the warehouse disappear. Has anyone come across this issue before?
  16. Does anyone have any evidence (anecdotal even) on which method would be quickest? Scenario A: Dispose of 200 static meshes and create 12 new ones. Scenario B: Dispose of the whole scene and create a new scene with 13 static meshes. Scenario C: Not sure this is possible, but can you make babylon.js not render meshes? I could "turn off" the 200 static meshes so they do not interact with lights and player input. This would be the preferred method, I think, since it would minimize object creation, which in C is an expensive process. I can test it, of course, but was wondering if anyone had any best practices on how to make that as seamless as possible. Thanks for any input. EDIT: Looks like setEnabled() may make Scenario C possible! I will test it! https://doc.babylonjs.com/classes/2.4/node
  17. Hello, I'm trying to export a model which is about 400,000 Polys. I know the maximum export is somewhere around 60, 000 for any one mesh. I am thinking about breaking and exporting the mesh in different parts. Will this lead to issues in the scene? Also, what is the best polygon count for a babylon scene for efficiency in web and mobile? Finaly, what is the maximum polygon count for a babylon scene before it crashes? Thank you in advance!
  18. I have recently started on a Babylon project, and I have been wanting to create a capsule physics impostor for my game. I found a test demo for Oimo.js that basically achieves what I want: compound test (capsule). There are two problems: 1. due to some shortcomings in Oimo, I have had to switch to Cannon.js. 2. the demo uses Three.js and I'm sure how to exactly translate that into Babylon. I basically want to be able to combine two sphere impostors with a cylinder impostor. I'm not sure what is the best method for this, there are only a few examples that I have found, and I haven't found anything in the docs. So I created an example to show what I am talking about: capsule sandbox. I have created the capsule mesh, but I just need to figure out how to add a capsule impostor. Thanks.
  19. The title might look impressive but there is a long way to go yet. I am playing around with the idea of colliding meshes that have concave parts to them and then reacting based on some physics that will use BabylonJS rather than a Physics Engine. "Why?" you may say - because it gives me something to do that I am interested in. So how far have I got? Not very far but have two things that appear to be working. I say appear as my testing is limited to two shapes which I have intersected in a couple of positions and it looks like it works. Be concerned be very concerned. The code makes extensive use of Jerome's work on facetData. 1. Finding the approximate points of impact of two meshes. http://www.babylonjs-playground.com/#XEJLM 2. Finding the center of mass of a mesh. (EDIT - Scroll down topic for playground version, following Jerome's advice) Demo http://grideasy.github.io/Babylon/com.html Code https://github.com/grideasy/grideasy.github.io/tree/master/Babylon Finding the approximate points of impact of two meshes. The basis to this is Find the overlap of the two meshes, one being the hitter and the other the hittee Split the overlap into 8 octants and recursively check each octant recursively as below until the octant is too small. Check if the hitter has any has any facets inside the current octant using the mid point of the overlap area to find the closest facet to it. If there is such a one project this onto the hittee (if such a projection exists). See if the two facets are close enough for impact, if so return the facet position from the hitter and the projected point from the hittee. If no two points are close enough split the current octant into 8 more octants and recursively repeat 2, 3, 4 and 5. If octants get too small and no hitter and hittee facets close enough return null. Finding the center of mass of a mesh. At some stage if the collision idea develops for more complex shapes the center of mass of the shape will be needed. In order to complete the code I had to add to Jerome's code within BJS version 2.6 itself and hence the code is in github not in the playground. As well as being able to get facetPositions and facetNormals I have added the capability to get facetAreas. To see these additions search for JK or facetAreas within the Babylon26JK.js code from the link given above. Warning Notes for Both Projects For speed the first two facets close enough are taken so may not actually be the best two facets to use. In calculating the center of mass for a mesh the mesh is assumed to be hollow and is based on the area of each facet, the density of each facet is assumed to be the same for all facets. I have not yet though about how to do it for a solid mesh (not that meshes are ever solid but perhaps calculations could be done as if they were solid). My coding is not particularly efficient and there are probably much better ways of achieving what I have done so far in terms of structure and use of existing BJS code but I am enjoying myself and if other want to join in make improvements then the more the merrier.
  20. Hi, Why is it that when I have a mesh disabled (i.e. mesh.setEnabled(false)) any intersectsMesh by it or against it returns true? Setting the method's second parameter 'precise' to true does not help. This output seems counter intuitive and I do not believe it is what anyone would expect. In fact, my intuitive expectation is that by having the mesh disabled, any intersectsMesh on it or against it should return false (even if the mesh being tested with it is in the same position that it would appear in if enabled). What do you think? Playground showing the problem (watch out for the browser console which prints the result of the intersectsMesh method testing two exclusive spheres in position which one of them is disabled): http://www.babylonjs-playground.com/#PD7PP#0
  21. I have a mesh (container) that contains another mesh (sphere). I'd like to set a material to the container mesh, in a way that it is applied to all the meshes it's parenting. (sphere in this case) I created a PG showing that it doesn't work: http://www.babylonjs-playground.com/#L69M2#1 Is such a thing not supposed to work? My main reason for doing it is adding a material on top of a mesh that already has a material without overriding the previous material. (stacking materials) e.g. adding a material that adds a 50% transparent black tint to a mesh that already has a material, without touching that mesh's material (sort of adding a material on top of it).
  22. Hey! I will just link the relevant code and then ask the question (ignore the material parameter, is from an older build still have to get rid of it): function GenerateRandomObject(scene, material){ var nekej = BABYLON.Mesh.CreateBox("box1", 1, scene); nekej.position = new BABYLON.Vector3(getRandom(8, 90, true), 0.5, 90); nekej.rotation.y = getRandom(0, 360, true); nekej.isVisible = false; BABYLON.SceneLoader.ImportMesh("", "_resources/", "Drevo2.babylon", scene, function (newMeshes, particleSystems) { newMeshes[0].parent = nekej; }); return nekej; } So this is the way I create every new instance of a background object. This happens about 0.5 - 2 times every second for this type of object. More with others that I create with similar functions just different imported meshes. So my question is if there is a better way to import/use an imported mesh so i would not need to import the same mesh over and over again every single time i create a new object with that mesh. Thank you very much for any answers you might provide, with best regards, Satiana
  23. Hi all, I found something weird while optimizing my code: I was using InstancedMesh as much as possible, and switched all my materials to ShaderMaterial. And then boom, everything disappeared. After a bit of research, it seems instanced meshes will simply not be drawn when their source has a ShaderMaterial assigned. Playground repro: http://www.babylonjs-playground.com/#TWDEA#6 Uncomment lines 40 to 44 to see for yourself. It's actually a bit more complex than that: when you assign a shader material to it, even the source mesh disappears if it has been instantiated (?), but only if its instances are in the field of view. I'm currently looking at BJS code and ANGLE_instanced_arrays doc (the extension used for drawing instanced meshes), but I thought I'd come here to fish for ideas... FYI these are two errors I noticed in the log when this problem showed (errors not always there): drawElementsInstancedANGLE: at least one enabled attribute must have a divisor of 0glDrawElementsInstancedANGLE: attempt to draw with all attributes having non-zero divisorsThanks
  24. Hi, I want to create city map with 3D buildings. I have GeoJSON with building data. I'm using this data to make 2D polygonal mesh (building shape). http://www.babylonjs-playground.com/#10IOII#14 (I've used example values) Is there way to add 3'rd dimension to it? I want to use my 2D mesh as base for 3D Object. Is it possible to store this 3D object as Vector3? I want to map all verticles and keep them around for future use. (I'm starting with babylon.js, i don't know is this proper way to do it.) { "type":"FeatureCollection", "features":[ { "id":"w26358613", "properties":{ "levels":8 }, "geometry":{ "type":"Polygon", "coordinates":[ [ [ 13.426143, 52.51832 ], [ 13.426195, 52.518392 ], [ 13.426155, 52.518423 ], [ 13.426192, 52.518479 ], [ 13.426252, 52.518476 ], [ 13.426296, 52.51854 ], [ 13.426473, 52.518496 ], [ 13.426319, 52.518275 ], [ 13.426143, 52.51832 ] ] ] }, "type":"Feature" } ] }
  25. Why ? var rawVerts = object.getVerticesData ? object.getVerticesData(BABYLON.VertexBuffer.PositionKind) : []; var rawFaces = object.getIndices ? object.getIndices() : []; BABYLON.Tools.Warn("MeshImpostor only collides against spheres."); returnValue = new CANNON.Trimesh(rawVerts, rawFaces); Even tho CannonJS supports mesh/plane collision ? : Demo : https://schteppe.github.io/cannon.js/demos/bunny.html Source : https://github.com/schteppe/cannon.js/blob/master/demos/bunny.html // ground plane var groundShape = new CANNON.Plane(); var groundBody = new CANNON.Body({ mass: 0, position: new CANNON.Vec3(0,0,-5) }); groundBody.addShape(groundShape); world.addBody(groundBody); demo.addVisual(groundBody); Edit: Ok, I overlooked the fact that the Mesh impostor is infact a Trimesh shape (https://schteppe.github.io/cannon.js/demos/trimesh.html). So can you add ConvexPolyhedron shapes in the next release please ?