Search the Community
Showing results for tags 'clone'.
-
We're working on having a trail of dust (ObjectParticles), and wish to set up a node of ObjectParticles one time and then clone it as it's needed. ObjectParticlesPtr sand_kick_actual = ObjectParticles::cast(Editor::get()->getNodeByName("ObjectParticles_0")->getNode()->clone()); sand_kick_actual->setEnabled(0); sand_kick_actual->setRadius(0.01f, 0.01f); sand_kick_actual->setWorldPosition(path_world_pos + random_offset); sand_kick_actual->setEnabled(1); However, at run-time this causes the following error message; Assertion failed! Program: ...ments\UNIGINE Projects\PBKC_2\bin\Unigine_x64d.dll File: engine\world\WorldSpatial.cpp Line: 2125 Expression: positions.find(position) != positions.end() && "WorldSpatial::removePosition(): can't find position" How do you go about cloning particle systems (or nodes in general) ?
- 1 reply
-
- c++
- objectparticles
-
(and 1 more)
Tagged with:
-
Hello, I try to optimize the creation/loading of our "avatar" at runtime. As I am working on a online game it can happen that the game need to create more than one "avatar" at the same time. So I made some "performance" test and for example creating 100 avatars took approximately 5 seconds. Instead of loading the node (which contains the ObjectMeshSkinned) and loading the skinner script each time I try to preload/clone them. But at the end it still too long. Here is my code Avatar(ObjectMeshSkinned preloadedMesh, Unigine::Skinner::Skinner precreatedSkinner, Unigine::Schemer::SchemerScript preloadedScript) { Node clonedNode = preloadedMesh.clone(); _mesh = class_cast("ObjectMeshSkinned", clonedNode); class_append(_mesh); _skinnerMesh = new Unigine::Skinner::SkinnerMesh(precreatedSkinner, _mesh); _skinnerMesh.setScript(preloadedScript); initialize(); } After commenting lines to find which line took all the time if found that it is _skinnerMesh.setScript(preloadedScript); I take a look at the code of skinner_mesh.h and I see that the script is compiled. Is there a way to preload and precompile a script and then to clone it ? So I have not to compile the script each time I create an avatar ? Thanks.
-
This adds the ability to interactively scale and rotate objects around their local z axis while using the placement tools. New type of clone added using the functionality (use CTRL + SHIFT + C to activate) Placement (CTRL + X) also works with this tool. Further documentation is included in the archive. Patch is in git format unigine_placement_patch.zip