I am trying to create a Object by merging many objects on a Plane
It is something like say there is a Plane and on that Plane I want a House , a shop , some trees
So i do a mergeobjects
Something like this :
house.translatemesh();
trees.translatemesh();
shop.translatemesh();
finalobject = mergeobjects (finalobject,plane);
finalobject = mergeobjects (finalobject,house);
finalobject = mergeobjects (finalobject,shop);
finalobject = mergeobjects (finalobject,trees);
trees.translate(100,0,0);
trees.translatemesh();
finalobject = mergeobjects (finalobject,trees);
shop.translate(0,0,100);
shop.translatemesh():
finalobject = mergeobjects (finalobject,shop);
trees.translate(100,0,50);
trees.translatemesh();
finalobject = mergeobjects (finalobject,trees);
The final Object I get always have different rotations.
I will try to be more specific
The objects gets merged ok but Cam.lookAt(finalObject.gettransformedcenter());
the transformed center is different If I add more objects
I want the cam to always lookAt the planes transformed center
The center of an object is based on some calculation based on the vertices of the object. It's actually the position of all vertices added up and divided by the number of vertices. If you add geometry to an object, you'll change this calculated center.
If you want the center to be fixed, you can set it yourself but be sure to do this after calling build() or build() will replace your own setting.
thanks