Jump to content

[SOLVED] Add script api to WorldCluster and ObjectMeshCluster to allow adding just one instance


photo

Recommended Posts

Currently ObjectMeshCluster and WorldCluster can only set whole content by one function all, but In our case, We need to plant some trees to scene, and I need them added to these Cluster objects, but with current design, seems there is no way to simply add some instance into Cluster, the only way is to rebuild the Cluster content by once.

 

For example, I have a WorldCluster composed by some tree references, and I want to add some more instances by simple clicking in scene( use world.getIntersection to get position), this is most easy way to edit the manually placed trees. but seems there is way to do this.

Link to comment
  • 2 weeks later...
but with current design, seems there is no way to simply add some instance into Cluster, the only way is to rebuild the Cluster content by once.

Actually, there is. In MeshCluster, Collect button is used to find in the world and bake meshes into MeshCluster. In WorldCluster Collector is used. It's all in the docs.

Link to comment

I know that, but what I want is this:

for world cluster

w_cluster.addNode(NodeReference ref, mat4 transfrom); // for adding just one instance
w_cluster.addNodes(NodeReference ref, int transform[]); // for adding an array of instances

 

for ObjectMeshCluster

o_cluster.addMesh(mat4 transform); // for adding just one instance
o_cluster.addMeshes(int transforms[]); // for adding an array for instance

 

I've just checked the ObjectMeshCluster and WorldCluster's source, the createMeshes function will first clear all existing meshes then create a whole new set of instance, also the same to WorldCluster.

 

I just want a add function not clear entire instance array, just add some, not replace whole array of instances...

 

And I know there are a workaround, get the transform array, add to that array, and rebuild the whole ObjectMeshCluster, but how is the performance compared to just add a few instance with rebuild whole array?

Link to comment

and this can be extremly useful when used these with a brush function. like for example, place some trees in scene, just use getIntersection to get the ground position and a mouse click, then a tree is planted.. then you don't need to care about if the tree is planted correctly on ground and make a script to aligh the trees center to ground intersection point again..

 

for some big scene, just add some fixed postions for some kind of stones, bushes, yes, you will say use ObjectMeshClutter with hand painted mask texture, so how long it will take a arist to paint a mask texture than directly paint/brush those stones/bushes directly in scene?

 

well, these are just my thought, and if unigine have this feature, it will be greate for our "Virtual Reality" :)

Link to comment
×
×
  • Create New...