Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to cut object at a particular position? #20

Open
tarun29061990 opened this issue Aug 19, 2015 · 0 comments
Open

How to cut object at a particular position? #20

tarun29061990 opened this issue Aug 19, 2015 · 0 comments

Comments

@tarun29061990
Copy link

Below is my code

var bBox = new THREE.Box3().setFromObject(doorMesh),
    cubeGeom = new THREE.BoxGeometry(bBox.size().x,bBox.size().y,bBox.size().z),
    cubeMesh = new THREE.Mesh(cubeGeometry,new THREE.MeshNormalMaterial),
    geom = new THREE.Geometry();

    cubeMesh.position.set(doorMesh.position.x,doorMesh.position.y,doorMesh.position.z);
    cubeMesh.updateMatrix();
    geom.merge(cubeMesh.geometry, cubeMesh.matrix);

    var cubeBsp = new ThreeBSP(geom),
          wallBsp = new ThreeBSP(wallMesh.geometry);

        var sub = wallBsp.subtract(cubeBsp);

I am doing the above steps but it's not working. However when I convert cubeGeometry to BSP instead of geom then it works but the cut is at the center of the object.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant