• Content Count

  • Joined

  • Last visited

  • Days Won


Everything posted by Nico

  1. Great ! I tried to use the setParent method, and multiply child scaling by parent scaling and then dispose the parent and it works great ! Here is the code I have to use to dispose a parent and keep the child position, scaling, and rotation in the world : childMesh.setParent((parentMesh.parent) ? parentMesh.parent : null, true); childMesh.scaling.multiplyInPlace(parentMesh.scaling); parentMesh.dispose(true); Thank you guys for helping Edit : Can any math guy can confirm if it is correct or not ?
  2. It tried to do this for rotation, scaling and position it works well when I delete the plane (here is the PG), but it does not work when I delete the red cube... (another PG here) If my plane position is different than 0,0,0 it does not work (third PG...)
  3. Here is the PG : I had to put the .babylon file content inside in order to load the 3D (there are not classic BABYLON boxes). After 5s I dispose the plane mesh (parent of all mesh).
  4. Yep for sure, I will do this as soon as possible
  5. It is sound more like a hack than a solution in my case (Because I can't edit the source file hierarchy) For more information, I want to be able to generate a new .babylon file from an existing file with only a part of the 3D. So I am providing a UI to show/hide meshes, and when I serialize the scene, I dispose all invisible meshes (to get a lighter file). Normally hiding a parent but not his descendant should not happen, but I don't want to be stuck if it happens one day Thanks anyway for the help
  6. HI ! Thanks for the answers ! I have tried it, and the result is the same as just call dispose(true). (I replaced the line child.parent = null;, by your code). Thank you for showing me this method, I will check the code inside to check if I can take some interesting parts @Wingnut : I will try this as soon as possible, and let you know the result, thanks again for the hints
  7. Huum I think I got why it does not work for second level children, this method reset all transforms and move vertices to get the same final visual, so it work well for direct children, but for second and deeper level children, it does not work since transform have been deleted. I have to find how to apply parent transform to a child mesh, and then dispose the parent, so I think it could work (tell me if I am wrong )
  8. Hi @Wingnut ! Thanks for the answer, I tried it and here is the result. It is better, but there is still something missing... Black and white cube (which are red cube's children) got some positionning problems... I will look at the bakeCurrentTransformIntoVertices code to try to understand how it works, thank you for the hint !
  9. Hi guys ! I was absent for a long time, but I am still playing sometimes with Babylon.js. There is so much new awesome and cool feature ! I came back here because I got a problem, I am trying to play with Mesh.dispose(), but in my case I want to remove a parent mesh, and keep children meshes, it work, using the parameter doNotRecurse, but it would like to do more than just keeping children meshes. I want to apply parents transformations to children meshes, in order to keep the children at same position, rotation, and scaling as they were before deleting the parent... I know it is possible to do that by applying parent transformation to children meshes, but I don't have enough 3D / math skills to do that alone... I know that some operation with matrix could do this, but I really don't know what to do... If someone can explain me how to proceed it would be awesome ! I attached an example, you can see the full scene on first screenshot, and on second screenshot I have disposed the plane. Here is the hierarchy : Plane ---- Green cube ---- Blue cube ---- Red cube -------- Black cube -------- White cube SimpleSceneWithHierarchy.babylon
  10. Thank you very much for the fix!
  11. Hello ! I have done a repro case using BabylonJS Playground, you can see it here : In this exemple I am not using the pick function, but the engine.getRenderHeight/Width function to show where is the problem. Since the pick function use this function too, the shift is the same in my exemple, so the particles source is the position you will get using the pick function. Edit : I have added picking on mouseup event.
  12. Here it is ! I have to add a line to the bjs version to make the RenderPipeline works. Inside the PostProcessRenderPass constructor, the _renderList property was not setted, so I added this line : this._renderList = renderList;You will find my custom bjs version inside the attached zip. I put particles to easy show the pointer position (in the 3D world). There is no problem if the renderPipelineManager has not yet attached pipeline to camera, the mouse pointer and the particle source are at the "same position", but when I attach the camera to the pipeline, there is this shift You just have to comment the line 46 to see the difference : postProcessRenderPipelineManager.attachCamerasToRenderPipeline("standardPipeline", camera, false);I still have a WebGL warning, but I don't know where it come from
  13. Thanks for the answer! I tried to call the pick function inside the callbacks (beforeRender, or afterRender), and the result is the same, there is always a WebGLTexture reference inside the _currentTargetRender
  14. Hi guys, I have been away for a long time, and I have now a little more time to play again with BabylonJS. I am using RenderPipeline, and I think there is a problem with this feature When I try to use scene.pick there is a shift (I don't know what is the best word to describe this) between my pointer positions and what the pick function returns, I have no problem if I don't use RenderPipeline (so I think the pointer positions values I am sending to the pick function are good). After some investigations I think I found something interesting, inside scene.pick BJS calls createPickingRay function, and I found this code inside : // Moving coordinates to local viewport worldx = x / this._engine.getHardwareScalingLevel() - viewport.x;y = y / this._engine.getHardwareScalingLevel() - (this._engine.getRenderHeight() - viewport.y - viewport.height);To get "y" value, it calls engine.getRenderHeight(), here is the code of this function : public getRenderHeight(): number { if (this._currentRenderTarget) { return this._currentRenderTarget._height; } return this._renderingCanvas.height;}So it is returning the height of the renderTarget if it exists, I use in the RenderPipeline so it exists in this case, but I can't use my screen size here (because of the non power of two texture size limitation in WebGL) so I manually set a 2048x2048 texture while my screen resolution is 1920x1080. If I use comment only the getRenderHeight part, I still have a shift, so the getRenderWidth is used too for the picking, but I didn't try to locate this, since using renderingCanvas width and height seems to solve the problem. These parts are causing this shift between my mouse click and the picking result, when I comment this code like that it seems to work : public getRenderWidth(): number { /*if (this._currentRenderTarget) { return this._currentRenderTarget._width; }*/ return this._renderingCanvas.width;}public getRenderHeight(): number { /*if (this._currentRenderTarget) { return this._currentRenderTarget._height; }*/ return this._renderingCanvas.height;}I don't know how to solve this problem in a clean way, but I have located the problem Does the pick function should always use the canvas width and height instead of using RenderTarget size ? So in this case a parameter can be sent through this two functions to force to return the canvas width/height instead of renderTarget ones, or should it use directly the "getRenderingCanvas" method to get the canvas, and then retrieve its width and height ?
  15. Thank you Deltakosh, I will update the wiki as soon as possible. Thank you for helping JCPalmer too, but I really need to read .babylon without loading them into a babylon scene
  16. No problem with that, but could you confirm that when I read a child mesh, its parent mesh will always be printed before? And when I read a mesh without parent previous mesh was the last mesh of its branch? ( = When you read a node, you read all nodes that are under it before reading its neighbor?)
  17. @SideraX: Thanks for helping, but Gwena is right, I found some things by reading code and .babylon files, but I can't know if files will always printed like this, that is why it would be great to have standard
  18. Hi guys, Do you know if there is a standard or something like that for the babylon 3D files? Because I have to parse them to get some informations inside, and if I can't be sure that the structure won't change, it could be dangerous... So I have make some tests, and I found some things: Parents are always printed before their children (nice for parsing!)It is written by branch (a top level node and all its children and its children's children... is a branch), so when I parse a new mesh with no parent I know that previous parsed mesh was the last of its branch, and I can drop all temp datas related to this branch.Could tell me if I am right, and is it possible if it doesn't exist yet to create a kind of standard for this files?
  19. Hi guys, I just try the Train demo and it works, but I have an error while I try to load HillValley, here is the error : XMLHttpRequest cannot load No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin '' is therefore not allowed access. (index):1BJS - [09:03:02]: error on XHR request. babylon.js:3Uncaught SyntaxError: Unexpected token u babylon.js:10
  20. Hi Davrous, I just try the new version of the sandbox, and it works like a charm, I can't reproduce the bug I have found before ! Thank you !
  21. My mistake, you are right. I was using the babylon version you have posted in this thread, not the latest beta, now with the latest beta it works without any problem ! Thanks again
  22. I have attached a small project to this answer, it just contains an html file, babylonJS code, my Tools.CreateScreenshot version and the blender scene, I hope it can help you
  23. You can find my code here I have used BuildOurOwnBabylonJS solution, so you just have to build and run it, and try it on a demo (I have added 2 buttons to quickly generate 720x720 screenshot with or without antialiasing).
  24. I have checked if I have to do something with activeCameras, and renderTargetTexture doesn't use activeCameras, but activeCamera, I think I was tired Friday ...