Jump to content

Search the Community

Showing results for tags 'clone'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • HTML5 Game Coding
    • News
    • Game Showcase
    • Facebook Instant Games
    • Web Gaming Standards
    • Coding and Game Design
    • Paid Promotion (Buy Banner)
  • Frameworks
    • Pixi.js
    • Phaser 3
    • Phaser 2
    • Babylon.js
    • Panda 2
    • melonJS
    • Haxe JS
    • Kiwi.js
  • General
    • General Talk
    • GameMonetize
  • Business
    • Collaborations (un-paid)
    • Jobs (Hiring and Freelance)
    • Services Offered
    • Marketplace (Sell Apps, Websites, Games)

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

  1. Hi, Just found this bug: an error broke the scene if we try to clone a mesh when we are in VR mode. Here's a PG: https://www.babylonjs-playground.com/#K7YG35 Thanks !!
  2. Hello. I'm having a problem mixing BackFace culling and mesh cloning. I generate meshes from a server code, and because of my coordinate system (which I can't change) the triangles are not property oriented. This is fixed used instances with a negative scaling and this works. At some point, after user action, I clone one of the the meshes which has wrong triangles, and then I apply the same transformation that fixes the orientation for the instanced meshes, but the cloned mesh triangles are not property orientated and thus the cloned mesh is not visible. This code worked for me on Babylon 2.5. This can be checked here : https://playground.babylonjs.com/indexStable.html#VI428J#3 Mesh named 'test' is not visible because triangles are not property orientated -> OK Instanced mesh 'testI' is visible because the scaling fixes the orientation -> OK Cloned Mesh is not visible and I don't know why. If backface culling is disabled, all three meshes are visible. Any ideas ? Thanks in advance
  3. shen

    clone mesh from GLTF

    I tried to clone meshes imported from GLTF file and found that meshes were cloned twice. https://www.babylonjs-playground.com/#PSR2ZX#38 https://www.babylonjs-playground.com/#PSR2ZX#39 use the debug layer, you can find that the original root mesh was used as the parent of a set of cloned meshes. I also wonder whether the scale of the cloned meshes is correct?
  4. Hy there! been long since i post in a while.. I've been trying to clone the animation of my model but it's not working! what am i doing wrong? this is a PG https://www.babylonjs-playground.com/#11BH6Z#358
  5. I dont know exactly what version this changed in, but there must have been someone MUST have been working on cloning. But now my cloned mesh.source = null. This code: mesh = prefab.clone(cloneName, newParent, false, false); It DOES clone the mesh and all its children BUT ... ALL the clones mesh.source is NULL
  6. Hi all, I am trying to clone an PIXI Container so that it will have no relationship with the original one, except that they both should share the same prototypes - DisplayObject, EventEmitter, Object. But somehow I loose the original Container, see demo:
  7. @Deltakosh I'm importing 2 separate meshes, and the second mesh gives me an error: I couldn't copy the console, so I'm sending a screen shot. No matter what .babylon file I use in the second import, I get the same error. Here's the code: // Import Biplane model, transform, and parent to box mesh BABYLON.SceneLoader.ImportMesh('', './Demos/models3/', 'Biplane_body.babylon', scene, function (newMeshes) { Rmesh = newMeshes[0]; Rmesh.scaling = new BABYLON.Vector3(4, 4, 4); //Rmesh.rotation.x = -(Math.PI / 2); Rmesh.rotation.y = Math.PI / 2; Rmesh.position.y = -100; for (let nb = 0; nb <= (Vcount - 1); nb++) { rocketsArray[nb] = Rmesh.clone('biplane' + nb); rocketsArray[nb].position.y = 0; //console.log(rocketsArray[nb] rocketsArray[nb].parent = boxRotArray[nb]; } }); BABYLON.SceneLoader.ImportMesh('', './Demos/models3/', 'Biplane_prop.babylon', scene, function (newMeshes) { Pmesh = newMeshes[0]; Pmesh.scaling = new BABYLON.Vector3(4, 4, 4); //Rmesh.rotation.x = -(Math.PI / 2); Pmesh.rotation.y = Math.PI / 2; Pmesh.position.y = -100; for (let np = 0; np <= (Vcount - 1); np++) { propArray[np] = Pmesh.clone('prop' + np); propArray[np].position.y = 0; //console.log(rocketsArray[nb] propArray[np].parent = boxRotArray[np]; } }); Please help if you can. DB
  8. Hello, If I create a simple Blender scene with a cube which rotates, When I clone the scene I can't get the animation to play. Any examples of something this simple? I need to clone many objects and start their animation at different times. DB
  9. Hello, I have a mesh (an airplane) which needs to be cloned 20 times - and then all 20 clones require their propeller to animate at different speeds and times. How do I identify each propeller or assign a variable (preferably a slot in a "propeller" array) to each cloned propeller to animate - once again animate separately. When I clone each airplane, how do I know the name of each child on the parent mesh, and animate it's children such as the propellers? How do I assign a unique name to each one? Once I have a unique name or variable assigned to each, then I can animate each one separately - but I don't know how to "Get" the names of cloned meshes or assign to a slot in an array upon cloning. Any ideas? DB
  10. This is one simple question but I haven't found an answer in the doc or here so I ask When I simplify a mesh and clone it after. Will my cloned mesh be simplified too or not? And have I to wait for the mesh to be simplified before cloning it to have the simplification on it? Thanks, Pichou
  11. Hello, I'm a new here, but I'm very exited with Babylon.js. I started my project with it, and already dealt with several problems (mostly connected with blender export). Thanks of the community and this wonderful forum But I reached a point that I can't proceed, have dug for a while, but didn't found a solution. When I clone a mesh, it is fine on laptop, but on iPad the result is not cloned object, but instance of it. I read on the forum that I should use computeBonesUsingShaders = false, ( http://www.babylonjs-playground.com/#GTHTR#1 ). I did it that way, and it is fine. But another problem arise - the cloned object doesn't show colors of the materials. Probably the best way to explain is an example. Here is it: http://www.babylonjs-playground.com/#GTHTR#20 My question is how to add colors to the cloned mesh? There are materials for t-shirt, socks, hair, etc. But all are missing. Thanks in advance.
  12. Hi All, I have issue with clone mesh and cloned mesh attach to parent. After attached to parent cloned mesh position behaving strangely. http://www.babylonjs-playground.com/#HWQ2QH Line 22-23-24 //behaving strangely I've been scratching my head for a while, any suggestion?
  13. Hi everybody. Here I come again with a new question for this incredible community. By the way, I think it will be "super easy" for someone which a good knowledge of the BJS internals. The case is that, following with my current development (tap simulator) I'm now focused on the performance. My doubts are mainly about the proper use of the method "clone" of the "Texture" object. Doubt 1) Suppose you have a Standard Material, you create it following the usual way, something like this: matFoo=new BABYLON.StandardMaterial("Foo_Material",myScene); matFoo.diffuseColor=new BABYLON.Color3(0,0,0); matFoo.opacityTexture=textFoo; matFoo.emissiveTexture=textFoo; Note that we are using the texture (textFoo) on two channels, opacity and emissive. Is this effective in terms of resource economy or I must follow this other approach?: matFoo=new BABYLON.StandardMaterial("Foo_Material",myScene); matFoo.diffuseColor=new BABYLON.Color3(0,0,0); matFoo.opacityTexture=textFoo.clone; matFoo.emissiveTexture=textFoo.clone; Doubt 2) Now we have a similar scenario, when we must assign a previously created texture, but this time we want to assign it to a series of Particles: ... textSprite=new BABYLON.Texture("assets/textures/flarealpha.png",myScene); ... myParticles=new BABYLON.ParticleSystem("Particles",10000,myScene); myParticles.emitter=new BABYLON.Vector3(0,0,0); myParticles.particleTexture=textSprite; ... This time, as we have a lot of particles chances are that it is better to use textSprite.clone() in order to assign the sprite image to each particle, at last line of shown code. Isn´t it? Doubt 3) Last but not least. When you (as me) arrives at the conclusion that PBR materials are the way-to-go (in order to achieve a decent look with your CGs), you are going to use, among others, the environment channel (dds files in current 3.0 version of BJS). Here I have certainly a doubt and a thought. Going first with the last, I think the environment should not be a PBR Material property (as currently is), but a scene one, as certainly is very weird to think in a scene with more than one environment (?). Anyway, as at the moment this is not the case, and we have to assign the same value of "environment" for each PBR Material, we find ourselves setting time after time the same texture (dds file) in this way (please focus only on the reflectionTexture property): ... matTube=new BABYLON.PBRMaterial("MaterialPBR_Tube",myScene); matTube.albedoTexture=new BABYLON.Texture("assets/models/Tubo_BaseColor.png",myScene); matTube.metallicTexture=new BABYLON.Texture("assets/models/Tubo_Metalico_PBR.png",myScene); matTube.bumpTexture=new BABYLON.Texture("assets/models/Tubo_Normal.png",myScene); matTube.reflectionTexture=textEnvironment; matTube.microSurface=0.96; matTube.useRoughnessFromMetallicTextureAlpha=false; matTube.useRoughnessFromMetallicTextureGreen=true; // matTap=new BABYLON.PBRMaterial("MaterialPBR_Tap",_Scene); matTap.albedoTexture=new BABYLON.Texture("assets/models/mono/Manetas_BaseColor.png",myScene); matTap.metallicTexture=new BABYLON.Texture("assets/models/mono/Manetas_Metallic_PBR.png",myScene); matTap.bumpTexture=new BABYLON.Texture("assets/models/mono/Manetas_Normal.png",myScene); matTap.reflectionTexture=textEnvironment; matTap.microSurface=0.96; matTap.useRoughnessFromMetallicTextureAlpha=false; matTap.useRoughnessFromMetallicTextureGreen=true; // matSprinkler=new BABYLON.PBRMaterial("MaterialPBR_Sprinkler",myScene); matSprinkler.albedoTexture=new BABYLON.Texture("assets/model/mono/Resto_BaseColor.png",myScene); matSprinkler.metallicTexture=new BABYLON.Texture("assets/models/mono/Resto_Metallic_PBR.png",myScene); matSprinkler.bumpTexture=new BABYLON.Texture("assets/models/mono/Resto_Normal.png",myScene); matSprinkler.reflectionTexture=textEnvironment; matSprinkler.microSurface=0.96; matSprinkler.useRoughnessFromMetallicTextureAlpha=false; matSprinkler.useRoughnessFromMetallicTextureGreen=true; ... Here, as in the case of my first doubt, I'm thinking, obviously in using "matXXX.reflectionTexture=textEnvironment.clone();", but I don´t know if that is a way to enhance performance, and by the way if dds files are buffered in a way they can benefit of texture cloning mechanism. Ok, this is all, sorry for the length of the question and, as always, thanks in advance for your time! Regards.
  14. I've successfully cloned a mesh and its skeleton with this code: this.mesh = Assets.avatar.clone(JSON.idx); this.mesh.skeleton = Assets.avatar.skeleton.clone(JSON.idx); I then run an animation like this: this.mesh.skeleton.beginAnimation("Idle",true,1); This works well on Windows browsers. I can have 10 people moving about with their own separate animations. Some running, some walking and some idle. However, this doesn't work on iPhone and iPad. If I animate one of the meshes then all of them will activate the same animation. If one is running then ALL of them will be running. Its as if they are all referencing the same animation. Does anyone know how I can get this to work on iPhone?
  15. Hello, When cloning a material - say, a BABYLON.StandardMaterial -, everything is fine except for renderTargetTexture. PG: https://playground.babylonjs.com/#BLG0FL material.clone() function calls renderTargetTexture.clone() function. But renderTargetTexture.clone() function creates a new empty RenderTargetTexture with the same properties. Btw, I'm sure that adding "scene.customRenderTargetTextures.push()" at the end of the clone function would resolve this issue. But I don't think that people want to create a new RTT each time they clone a material (it would kill the app, especially on iOS devices). Not sure about which behaviour adopt here, any idea ? Thanks !
  16. I'm trying to make a menu like option to where the user can drag a sprite on screen and make a clone out of it leaving the other sprite on it's original location. This is what I have up untill now. var box = game.add.sprite(100, 200, 'box', 0); box.anchor.set(0); box.inputEnabled = true; box.events.onInputDown.add(clone, this, 0, box); function clone(obj){ var clone = game.add.sprite(obj.x, obj.y, obj.key, obj.frame); clone.inputEnabled = true; clone.input.enableDrag(true); } Only down side is I have to click twice on the sprite in order for there to be a copy of it which kind of takes away the whole purpose of a copy on drag function. Any help would be greatly appreciated. (I'm quite new to Phaser and js so I'm sorry for any obvious mistakes beforehand) Thanks in advance!
  17. I try to optimize one of my scene and to do so I adapt my code to use createInstance instead of clone. But as a result my scene (fps) is slower with createInstance than with clone when it should be the opposite right? To sum up my code, here is the steps I follow : - import mesh - clone mesh and add material (because one mesh can have 2 different materials) - create instance mesh - add in the scene At the third step, I get a better fps when I use clone instead of createinstance. Do you have an idea? Thanks!
  18. Is there a way to clone an imported mesh to use it in a different scene? I try to change the _scene parameter of the mesh like that : this.mesh._scene = newscene; but I got an error. It seems like I must import all my meshes twice in both of my scenes. Unfortunetly it will increase the loading time. Looking for suggestions! Thanks
  19. When i recreate texture or material, clone/dispose created more one texture (clone logic incorrect material.texture.clone() and material._texture.clone()) example https://www.babylonjs-playground.com/indexstable#Y48SUQ this is very important for dynamic scene, please fix source ** I tryed run in this latest version and saw what recreate correctry, but i not undersend how... and other -- i see what canvas2D will be not suported in future? I see GUI, this is very cool feature, but GIU can't do many tasks... Tell me whether it is possible to work with canvas2d in babylon.js 3.0, or will the support be returned in the future?
  20. Hi, I have question about creating meshes based on one prototype. I have multiple meshes, that have same geometry but should have different material (color), idea was to create prototype mesh in 3d max, add bump map and export it. Than I found that Mesh class have source mesh, so I passed my prototype mesh into mesh constructor: PG So far everything was working I could create new meshes and change material for them. But problems started when I tried to create instances from new meshes as all instances where moved to same position: PG But if I make clones from meshes they work: PG Was it designed to be used like that, or I am overusing system Maybe there is better way to achieve same result? prototype -> different meshes -> instances. @Deltakosh some ideas there?
  21. Hi, I want to clone meshes that I load with the obj loader. The problem seems to be that the material is assigned somewhat later, so when I clone the mesh directly in the callback from the SceneLoader.ImportMesh function, it has no material. If I make another clone from the very same instance some time later, it has material. For example this would lead to no material in the clone: BABYLON.SceneLoader.ImportMesh("", this.serverUrl, encodeURIComponent(fileName + ".obj"), this.scene, (mesh) => { meshContainer = mesh.clone(name, undefined, false); resolve(meshContainer); } while this would: BABYLON.SceneLoader.ImportMesh("", this.serverUrl, encodeURIComponent(fileName + ".obj"), this.scene, (mesh) => { setTimeout(() => { meshContainer = mesh.clone(name, undefined, false); resolve(meshContainer); }, 100); } (It is wrapped inside a Promise) Is this an expected behaviour? Is it possible to get the callback when everything is loaded completely? Many thanks, Cheers, janx
  22. Hi, after loading incremental scene file on load finish I cloned one of mesh BABYLON.SceneLoader.Load("", scenePath, this.engine, (scene) => { scene.meshes.forEach((mesh) => { if(mesh.name === "m1") { mesh.clone("m2", mesh.parent, false, false); mesh.clone("m3", mesh.parent, false, false); } }); }); Probably it was not designed to work like that but every thing works as expected but I get console errors _this._delayLoadingFunction is not a function inside: Mesh.prototype._queueLoad = function (mesh, scene) { var _this = this; scene._addPendingData(mesh); var getBinaryData = (this.delayLoadingFile.indexOf(".babylonbinarymeshdata") !== -1); BABYLON.Tools.LoadFile(this.delayLoadingFile, function (data) { if (data instanceof ArrayBuffer) { _this._delayLoadingFunction(data, _this); } else { _this._delayLoadingFunction(JSON.parse(data), _this); } _this.instances.forEach(function (instance) { instance._syncSubMeshes(); }); _this.delayLoadState = BABYLON.Engine.DELAYLOADSTATE_LOADED; scene._removePendingData(_this); }, function () { }, scene.database, getBinaryData); return this; };
  23. 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
  24. 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
  25. hi, I tried to create instances of meshes, basically cloned my loaded meshes and then create instances of that clones, but run into issue. some instances created fine but others throws in console "[.CommandBufferContext.Offscreen-MainThread-0x12d4118a0a00]GL ERROR :GL_INVALID_OPERATION : glDrawElementsInstancedANGLE: attempt to access out of range vertices in attribute 2" during render. I also created small demo http://www.babylonjs-playground.com/#1NAQZD#8 . looks like this errors occurs only when some of the instances out of screen, maybe I forget something or this approach can't be used, but didn't found in docs any restrictions about using clones and instances. so what is the right approach to solve this? using Chrome Version 51.0.2704.103 (64-bit)
×
×
  • Create New...