Um, it seems the usage of Geometry.merge() works as intended. Check out the following live demo which demonstrate the merge of two geometries: https://jsfiddle.net/mgq3p09w/
Thank you.
I created 2 mesh, and merged successfully.
But the path(old code) won’t merge with other mesh. I can’t change the color of it. I can remove the path. and It disappeared. It is not a part of the combination.
https://jsfiddle.net/5os9xj0L/1/
mouse down and release the square will draw a path, I want the path to be merged with circle.
I’ve been struggling for days, so frustrated.
Thanks a lot.
When you merge geometry, you have to notify the renderer that the (face) data have changed. You can do this by setting Geometry.elementsNeedUpdate to true. Besides, when updating the material color to orange, it’s not necessary to create a completely new material. You can just set the color property to the desired value like so: plane.material.color.set( 0xff6600 );.
You also have this error in your app:
three.js:11085 THREE.DirectGeometry: Faceless geometries are not supported.
This is because the very first shape you generate consist of only two lines. This is something that ShapeGeometry can not triangulate. Hence, you produce a faceless geometry which is not a valid in context of meshes. To avoid this problem, init your array with two additional points like demonstrated in the updated fiddle: