Nico

Members
  • Content Count

    81
  • Joined

  • Last visited

  • Days Won

    1

Nico last won the day on May 14 2014

Nico had the most liked content!

About Nico

  • Rank
    Advanced Member
  • Birthday 05/23/1991

Profile Information

  • Gender
    Male
  • Location
    Lille (France)
  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 : https://www.babylonjs-playground.com/index.html#MG4WD5 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 : http://www.babylonjs...d.com/#2DWHRN#3 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 PostProcesses.zip
  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