Jump to content

Subtract in place help?


cclark440
 Share

Recommended Posts

I have been trying to figure out the subtracting. I figured out how to create a new mesh , ( the large green cylinder), that has the subtracted portion of two other meshes but, I can't figure out how to just subtract part 2 ( the small green cylinder) from part 1, ( the large white cylinder) in place.

Is it possible to create the subtracting geometry without ever rendering it? I have spent a s fair amount of time trying to figure this out on my own. I just haven't found an example that seems to be what I need or, I am looking in the wrong places?

http://www.babylonjs-playground.com/#1RWE59#93

 

As usual any and all help would be greatly appreciated.

Link to comment
Share on other sites

1 hour ago, cclark440 said:

Is it possible to create the subtracting geometry without ever rendering it?

 

var subCSG = CSGStem.subtract(wHole);
var mesh = subCSG.toMesh("csg",myMaterial,scene);
// this is the geometry, but it's a private property, so not supported. 
var geometry = mesh._geometry;

// you can apply this geometry to other meshes:
geometry.applyToMesh(otherMesh);
 
edit: adam has correctly pointed out we should be using the geometry property (without underscore)!
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...