Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Migrating GeometryUtils.merge() to geometry.merge()

Migrating from r66 to r67 I get the message:

DEPRECATED: GeometryUtils's .merge() has been moved to Geometry. Use geometry.merge( geometry2, matrix, materialIndexOffset ) instead.

It doesn't seem to be a direct conversion as the old code looks like this:

THREE.GeometryUtils.merge(cgeo, cloudgeometry);

I have tried the following:

cgeo.merge(cloudgeometry.geometry,cgeo.matrixWorld);

Edit, have also tried the following which produces the same result as above:

cgeo.merge(cloudgeometry.geometry);

The results are a mesh which is compressed in area as if it is completely ignoring the positioning of the sub meshes which are being added to the new mesh I created, so rather than a large nice looking cloud I get a small white blog.

There is no documentation for this latest change so I am trying to understand how it works blind, if it was a simple 1 for 1 migration it would have been nice as it would have worked but it appears the way it works completely changed.

like image 568
Bhikshu Eshin Gansho Avatar asked Jun 22 '14 17:06

Bhikshu Eshin Gansho


1 Answers

Make sure the matrix has been updated before merging. The code should probably look something like this:

cloudgeometry.updateMatrix();
cgeo.merge( cloudgeometry.geometry, cloudgeometry.matrix );
like image 88
mrdoob Avatar answered Sep 26 '22 22:09

mrdoob