LucidObscurity Posted July 23, 2016 Share Posted July 23, 2016 (edited) There appear to be cases where CSG is working in Parent space instead of World space as (as I understand) it is supposed to. I've only noticed the issue once there are at least three nodes in the ancestry tree, but I'm not sure that has anything to do with the issue. I apologize ahead of time if I am just misunderstanding some aspect of what I'm doing in this example, but it sure doesn't seem like expected behavior. Please view the example here and see the comments at about line 45: http://www.babylonjs-playground.com/#18JSAT#0 Any help is greatly appreciated. Thanks. Edited July 23, 2016 by LucidObscurity typo Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted July 26, 2016 Share Posted July 26, 2016 Hello this is a good catch. I add it to my backlog In the meantime you can still unparent the object before playing with CSG. Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted July 29, 2016 Share Posted July 29, 2016 Hum..just checked the code and it is performing in WorldSpace. Can you try to simplifying your repo to only have two objects (and not 3) in your hierarchy? Quote Link to comment Share on other sites More sharing options...
LucidObscurity Posted July 29, 2016 Author Share Posted July 29, 2016 Thanks for taking a look. Unfortunately I've not been able to reproduce the issue without the 3rd level. I've commented out the line where my 'cookie cutter' meshes are being disposed and have removed the caps from the extrusions so you can see where they exist in world space. http://www.babylonjs-playground.com/#18JSAT#1 Hope this helps. Thanks. Quote Link to comment Share on other sites More sharing options...
LucidObscurity Posted August 22, 2016 Author Share Posted August 22, 2016 I've tried to simplify as much as possible. Hope this helps. http://www.babylonjs-playground.com/#18JSAT#8 Thanks. Quote Link to comment Share on other sites More sharing options...
Nabroski Posted August 22, 2016 Share Posted August 22, 2016 Hello maybe i can investigate something in this problem // Moving elements father.position = new BABYLON.Vector3(10, 10, 0); // Using a vectorhttp://www.babylonjs-playground.com/#18JSAT#9 you are pushing an array father = verts.map(Vector) son = father.map(father+NEW Vector) //pushing a new vector and adding the the previous Also its a bit unfair becourse you changed the order you declare it by grandf father son and the you call it son (array at pos 0) father.position = new BABYLON.Vector3(10, 10, 0); // Using a vector father (array at pos 1) son.position = father.position + new BABYLON.Vector3(10, 10, 0); grandf Quote Link to comment Share on other sites More sharing options...
LucidObscurity Posted August 23, 2016 Author Share Posted August 23, 2016 Thanks Nabroski, Yes, I see what you did there. Your change also proves the possible bug. Since CSG is supposed to work in GLOBAL/WORLD space, then doing CSG subtraction on the father with a mesh at around <10,10,0> works as expected, but then, subtraction on the son should be done with a mesh at around <20,20,0>. For some reason, the mesh used to subtract from the son only works if the mesh is at around <10,10,0> (as in my example - the distance from father to son) or if the son is moved to <31,31,0> and the cutter mesh is at <20,20,0> (as in your example - now the distance from father to son is <21,21,0>). Either way, it is behaving as if the cutter mesh is in the son's PARENT space, when in fact, it is not (as can be seen by it's actual rendered location). Thanks again, I'm hoping this can be fixed someday...for now I'm rewriting my project to do all the cuts before parenting...which is much tougher to visualize...but it should work. Quote Link to comment Share on other sites More sharing options...
adam Posted August 23, 2016 Share Posted August 23, 2016 For some reason it works when you do CSG on the son after the father and grandfather. http://www.babylonjs-playground.com/#18JSAT#12 This doesn't work if father is commented out: http://www.babylonjs-playground.com/#18JSAT#13 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.