Jump to content

Possible Bug Where CSG working in Parent space not World space


LucidObscurity
 Share

Recommended Posts

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 by LucidObscurity
typo
Link to comment
Share on other sites

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.

Link to comment
Share on other sites

  • 4 weeks later...

Hello maybe i can investigate something in this problem

// Moving elements
    father.position = new BABYLON.Vector3(10, 10, 0);   // Using a vector

http://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

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...