Jump to content

Search the Community

Showing results for tags 'Node'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


  • Welcome to UNIGINE Forums
    • News & Announcements
    • Getting started
  • Development
    • Content Creation
    • World Design
    • Rendering
    • Animation
    • Physics, Navigation and Path Finding
    • UI Systems
    • Sound & Video
    • Editor
    • C++ Programming
    • C# Programming
    • Networking
    • Sim IG (Image Generator)
    • VR Discussions
    • General
  • Improving UNIGINE
    • Documentation
    • Feeback for UNIGINE team
    • Bug Reports
    • Unigine SDK Beta feedback
  • Community
    • Collaboration
    • Tools, Plugins, Materials & Tutorials
    • Showcase
    • General Discussions
  • Legacy
    • UnigineScript

Find results in...

Find results that contain...

Date Created

  • Start


Last Updated

  • Start


Filter by number of...

  1. Hello, we are running into a cpu bottleneck while updating matrices via setTransform on nodes. We do have 50 instances with about 20 subtransformations for each node, which will be updated every frame. Is there a faster/better way to update positions/orientations. Version is 2.8 , renderer is directx. Thank you for your help.
  2. [SOLVED] ung at runtime

    Добрый день, столкнулся со следующей проблемой: Не могу прочитать файлы из ung архива, созданного в runtime При выполнении приложения выполняются следующие функции: 1) С помощью плагина CadImporter импортирую step файл с иерархией в папку data/imported/step_name/. В папке step_name/ создаются меши и нода: data/imported/step_name/step_name.node data/imported/step_name/sub_shape_0.mesh data/imported/step_name/sub_shape_1.mesh и т.п. В самой ноде при импорте все пути прописываются следующим образом: <node type="ObjectMeshStatic" id="107603081" name="sub_shape_0"> <mesh_name>../data/imported/step_name/sub_shape_0.mesh</mesh_name> <surface name="GRAY62 (0.647059,0.619608,0.588235,1)" material="841f9d7a08f60719b7bc9a8e16d254a870513a5f" property="d99ebc8ef5769d70b1e46992309cc3e7d1aa2faa"/> <transform>1 0 0 0.0 0 1 0 0.0 0 0 1 0.0 0 0 0 1.0</transform> </node> 2) С помощью ung_x64, вызовом командной строки, архивирую папку step_name/ 3) Удаляю исходную папку step_name/, таким образом в системе остается только один файл архива. Выглядит следующим образом: data/imported/step_name.ung 4) Перезагружаю мир 5) Пытаюсь загрузить ноду следующими методами: Unigine::NodeReferencePtr noderef = Unigine::NodeReference::create("../data/imported/step_name/step_name.node"); // or Unigine::NodePtr node = Unigine::World::get()->loadNode("../data/imported/step_name/step_name.node",0); и получаю ошибку - Xml::load(): can't open "step_name/step_name.node" file World::loadNode(): can't open "step_name/step_name.node" file При поптыке загрузить архив с помощью функции Unigine::FileSystem::get()->loadPackage("../data/imported/step_name.ung"); получаю false При работе из папки, без использования архива, нода загружается корректно. По требованиям проекта должна быть предусмотрена загрузка сторонних step файлов и дальнейшее их хранение в архивах, с возможностью передачи между различными клиентами. Так как доступа к редактору у них нет, то все это должно работать на релизной версии программы. Подскажите, пожалуйста, в чем может быть проблема при чтении нод, созданных в рантайме, через ung архивы. Возможно есть более гибкие решения для данного вопроса. Используется Unigine SDK
  3. Nodes redistribution

    We are thinking about the way to “redistribute” nodes to our customers. The use case: customer has a binary executable to load several nodes (ship models) at runtime and the list of available nodes must be expandable by providing new models. So the goal is: 1. Create new node (ship model) with materials, textures and so on. 2. Pack this node with required assets somehow. 3. Redistribute this package to customer. 4. Load new node at customer side by using existing binaries. Is there a way to create ung-file from node for future use in other project ?
  4. Hello everyone, I would like to ask, is there any way to provide collision between two nodes? I added two objects as ".node"(FBX) file and tried to set collider on them.But unfortunately I couldn't check any collision is available between them.According to this collision I would like to give some effect like explosions on objects. simply, Unigine::NodePtr node1; Unigine::NodePtr node2; then I initialize node objects for them which is available in Unigine editor,mReference represent parent node(everything works and I can show them in Unigine engine(these two objects are available on the screen)) node1 = Util::Search::getNodeRecursive("Body", mReference->getNode()); node2 = Util::Search::getNodeRecursive("Turret", mReference->getNode()); then, I set collider for second object and first object, node1.setCollider(1); node2.setCollider(1); then, I move node1 to the node 2 object in for loop. node1.setPosition(Vec3) // it starts to move second object But unfortunately I don't know how to check they touch each other or not.Simply node1 passes node2 and goes away.(There is no tutorials for Node collision) Any help would be appreciated.
  5. Hi, is there a fast way to export a Node reference with all its subobjects (objects,meshes,materials,textures) into a single folder. Our Artist imported a fbx file in Unigine Editor and I want only the converted assets, to load it later with the c++ api on the fly at any given location in the filesystem dynamically. I know, that they are saved in the .runtime folder, but it is hard to search for every object/mesh/material/texture manually with a few hundred subobjects uglyfied. Thanks, Sebastian
  6. [SOLVED] Node 3D to NDC coordinates

    Hi, I need the 2D screen Position of a 3D Node transformation. Can you write me a short code example with unigine matrices form the Player and Node and perspective division to get the NDC coordinates? auto proj = m_player->getProjection(); auto view = m_player->getTransform(); auto obj = instance->second->getNode()->getTransform(); auto projectedPosition = Unigine::Math::Mat4(proj)*view*obj*Unigine::Math::Vec4(0.0, 0.0, 0.0, 1.0); projectedPosition /= glm::abs(projectedPosition.w); x = (projectedPosition.x+1.0f)*0.5f * m_ungineAppHandle->getWidth(); y = (1.f-(projectedPosition.z+1.0f)*0.5f) * m_ungineAppHandle->getHeight(); Thank you in advance, Sebastian
  7. Hello, I encountered something weird manipulating BoundingBox with UnigineScript, here's the code part reproducing the problem : BoundBox bb = node.getBoundBox(); //bb.setTransform(mat4(node.getTransform())); vec3 p1 = bb.getMin(); vec3 p2 = bb.getMax(); engine.visualizer.renderPoint3D(Vec3(p1), 0.1, vec4(1, 0, 0, 0.5), 0); engine.visualizer.renderPoint3D(Vec3(p2), 0.1, vec4(1, 0, 0, 0.5), 0); engine.visualizer.renderNodeBoundBox(node, vec4(0, 0, 1, 0.5)); (The code has to be run with engine.visualizer.setEnabled(1); called, and a valid node instance loaded). The visualizer part shows on my program 2 random points (red ones), not matching with any of the bounding box points (rendered in blue). The commented line solves the problem if uncommented., so I think the transform matrix of the node is not assigned by default to the bounding box, which might look like a bug. Thank you. EDIT : By the way, the setTransform() method is not referenced (but still usable) in the UnigineScript doc.
  8. [SOLVED] Node export for Node Reference

    Hi, is it still possible, to export an object or asset, a mesh with materials (which I edited in the editor) as a node, to use it with the node reference? At the moment I can only find the possibility to use an FBX file with a node reference. The issue I have with that is, that I need to edit all the elements outside of Unigine, (e.g. the assignement of the materials). Thx. Werner
  9. Hi, In a unigine script, I would like to save a Node (recursively) in a .node file. I've searched in the documentation in the functions of engine.world but it seems that the function saveNode() exists only for C++ and C#. https://developer.unigine.com/en/docs/2.3/api/library/engine/class.world?rlang=usc I've tested anyway the function engine.world.saveNode(file, n) in my unigine script and I was happy (and also surprised) that it works. I need to know : is it an omission in the documentation ? or is it a function that will disapppear later ? Regards
  10. Hi everyone, There are a question about rotate a node, There is the default material in the new C++ project's scene: After rotate the material_ball about Y-axis by these code: node = Editor::get()->getNodeByName("material_ball"); Mat4 transform = node.get()->getTransform(); mat4 rot = rotateY(90.0f); node.get()->setTransform(transform * Mat4(rot)); The material_ball become this: And then I rotate it about Z-axis by these code: node = Editor::get()->getNodeByName("material_ball"); Mat4 transform = node.get()->getTransform(); mat4 rot = rotateY(90.0f); mat4 rot2 = rotateZ(-30.0f); node.get()->setTransform(transform * Mat4(rot) * Mat4(rot2)); The material_ball become this: Form the above view, I find that the rotate function is rote the node about it's own axis, How can I rotate it about the world axis ? I have tried the setWorldTransform function like this: node = Editor::get()->getNodeByName("material_ball"); Mat4 transform = node.get()->getWorldTransform(); mat4 rot = rotateY(90.0f); mat4 rot2 = rotateZ(-30.0f); node.get()->setWorldTransform(transform * Mat4(rot) * Mat4(rot2)); But it's result is the same with setTransform function.
  11. Hi, I have a world node. I want to find any points z value when I give x and y. What function should I use?
  12. Hi, I would like to create a node hierarchy in a script and add it to the editor. I've made a simple project to test that, with a simple body, a static graphic mesh (child of the body) and a convex shape from the mesh. But when I create the nodes in the script, the mesh appears in the editor's view before i had it to the editor. Here is my code from unigine_project.cpp (the zip of the project is in the attached file also). #include <core/unigine.h> int init() { // load editor if (!engine.editor.isLoaded()) { engine.console.run("editor_load"); } PlayerSpectator camera = new PlayerSpectator(); camera.setPosition(Vec3(2.0f,0.0f,1.5f)); camera.setDirection(Vec3(-1.0f,0.0f,-0.5f)); engine.game.setPlayer(camera); ///////////////////////////////////////// // create node hierarchy in the script ///////////////////////////////////////// ObjectDummy m_rootNode = class_remove(new ObjectDummy()); m_rootNode.setName("ROOT"); //m_rootNode.setEnabled(0); // create body and convex shape Body body = class_remove(new BodyRigid()); m_rootNode.setBody(body); ObjectMeshStatic objMesh = class_remove(new ObjectMeshStatic("chassis.mesh", 0)); ShapeConvex shapeConvex = class_remove(new ShapeConvex()); shapeConvex.setObject(objMesh, -1, 0.125); shapeConvex.setBody(body); shapeConvex.setName("shape convex"); // graphic mesh objMesh.setName("mesh"); objMesh.setMaterial("mesh_base","*"); objMesh.setProperty("surface_base","*"); objMesh.setCollider(0); // add child to the root node m_rootNode.addChild(objMesh); // Question : Why at this point we can see the mesh in the scene ? // Question : Why when I click on it in the editor I get the error : ObjectDummy 000000000CFE8D00 external (115:0:0) is not an editor node // add the node to editor //engine.editor.addNode(m_rootNode); return 1; } int shutdown() { return 1; } int update() { return 1; } - Why can we see the mesh in the editor's view before adding it to the editor ? - Have I made something wrong in the construction ? - I've seen in a post that if I disable the node in the script, ( cf line //m_rootNode.setEnabled(0) ) it makes the mesh disappeared. Is this the solution or only a trick ? Thanks in advance, Philippe unigine_project.zip
  13. Hi, In the documentation (https://developer.unigine.com/en/docs/1.0/scripting/library/nodes/class.node#getChild_int_Node), we can see : Node getChild (int id) Returns a given child of the node. Arguments int id - ID number of the child. Return value Child node. is the argument a ID number or an Index number ? If it's an index number, could you update the documentation ? Thanks, Philippe
  14. I'm automating the process of creating tiled terrains through code and I have an unusual problem when saving the node files. <?xml version="1.0" encoding="utf-8"?> <nodes version="1.19"> <node type="ObjectTerrain" id="575191784" name="Terrain_x7_y11"> <terrain/> <lod_distance>20</lod_distance> <lod_progression>2</lod_progression> <flatness_threshold>3</flatness_threshold> <visible_distance>8000</visible_distance> Basically my terrain tag is completely empty. I'm not sure that my script has any knowledge of the terrain filepath being saved at all. Should I: 1. Generate the terrain. 2. Save it to a node file. 3. Load the terrain node file ?? Or is there some other/better method for this
  15. [SOLVED] Ptr Problems

    So, I have something nice and simple. Unigine::Engine *engine = Unigine::Engine::init(UNIGINE_VERSION, acrgc, argv, NULL); for(initialize for loop) { Unigine::ObjectDynamicPtr obj = Unigine::ObjectDynamic::create(); *do stuff - even if all of this is commented out it crashes Unigine::Editor::get()->addNode(obj->getNode()); } While(engine->isDone() == 0) { engine->update(); engine->render(); engine->swap(); } The problem is that it always crashes on update. I've tried to release the obj Ptr but that doesn't work either. Anybody have an idea?
  16. Hi there, To control the weather in a scenery, I'm using the following code. Like this I can control the height of the clouds received by a Cigi packet. Now, I want to control the clouds in depth, slice, density, etc from the ObjectSky class. But I don't see how to get to this derived class to apply their methods. Node clMiddle = engine.world.getNode(id); if (clouds == NULL) { log.message("getNode(clMiddle) failed\n"); } clMiddle.setPosition(dvec3(0.0, 0.0, clBase));
  17. Hi all, I've attached a basic sample based on tracker/nodes_00 sample. Basically it should make the same, but with the following differences: I've added a new node called 'my_statue' loaded from a node file I've added a track parameter to change 'my_statue' position in nodes_03.track When you run the sample 'my_statue' remains static, if you load track in tracker editor you can verify the tracker parameter it's resolved for this node, but the id is different from the id expressed in Nodes editor. Two more observations: In tracker editor, If you change the name to 'my_statue_0' (accept the error) and restore the name again the node is resolved properly. If I change TrackerParameter::loadTrack() to ignore "id" Xml argument it works. Tested in: 08:51:50 Loading "D:/_development_/externalvc10/UNIGINE/UNIGINE_Sim_source_windows_2014-07-07/bin/../data/unigine.cfg"... 08:51:50 Loading "Interface_x64.dll"... 08:51:50 Loading "dxgi.dll"... 08:51:50 Loading "openal32.dll"... 08:51:50 Set 1366x768 windowed video mode 08:51:50 Unigine engine http://unigine.com/ 08:51:50 Binary: Windows 64bit Visual C++ 1600 Release Jul 7 2014 r14944 08:51:50 Features: OpenGL Direct3D9 Direct3D11 OpenAL XAudio2 XPad360 Joystick Flash Editor Double 08:51:50 App path: D:/_development_/externalvc10/UNIGINE/UNIGINE_Sim_source_windows_2014-07-07/bin/ 08:51:50 Data path: D:/_development_/externalvc10/UNIGINE/UNIGINE_Sim_source_windows_2014-07-07/data/ 08:51:50 Save path: D:/_development_/externalvc10/UNIGINE/UNIGINE_Sim_source_windows_2014-07-07/bin/ 08:51:50 08:51:50 ---- System ---- 08:51:50 System: Windows 8 (build 9200) 64bit 08:51:50 CPU: Intel® Core i7 CPU 960 @ 3.20GHz 3238MHz MMX SSE SSE2 SSE3 SSSE3 SSE41 SSE42 HTT x4 08:51:50 GPU: NVIDIA GeForce GTX 560 Ti x1 08:51:50 System memory: 22526 MB 08:51:50 Video memory: 1024 MB 08:51:50 Sync threads: 3 08:51:50 Async threads: 4 Best regards. tracker.tar
  18. Hi folks! I'm currently facing a rather annoying issue in Unigine, created by myself and my lack of understanding of course, which I need your help on! My situation is this: I have two characters, I want to calculate the mid-point between these two characters' heads and make a camera inside of the game look at that mid-point. What I am currently doing is: 1. Cycling through bones and finding the head bones of each character 2. Using ObjectMeshSkinned::getWorldBoneTransform to get the transform of each head bone as a mat4 3. Getting the 12th, 13th and 14th values from the head bone mat4s that represent the position of the head bones 4. Creating two separate vec3s for each head bone position using the values from stage 3 5. Finding the distance between the two values and normalising them to give me a look direction for my camera 6. Using Node::setDirection to set the direction the camera is facing like in the default setup of: camera = new PlayerSpectator(); camera.setDirection(Vec3(-1.0f, 0.0f, -0.5f)); The script I am using to get the PlayerSpectator from the world is: PlayerSpectator camera_Player = node_cast(engine.world.getnode(0123456789)); My problem is: When I try to do anything PlayerSpectator/Player/Node related with the PlayerSpectator variable I get an error saying: Project001/Project001.cpp: 1092: ExternClass::run_function(): can't find "class PlayerSpectator * __ptr64" base class in "class PlayerDummy" * __ptr64" class Can anyone suggest what I am doing wrong? Should I not node_cast cameras or something? Am I referencing them the wrong way? I can't even call Node::getNodeName or anything! Thanks in advance for your help! Tom
  19. When I export my mesh from max it appears fine in engine. When I export as node I get errors saying can't load .mat, can't load .mesh. I have tried all of the different settings in the node export tool with no success...
  20. Hello, I wanted to know if I have applied a material "red" to Node A and apply material "green" to Node B and if I make Node B child of Node A, will the materials applied to Node B be overidded with materials of Node A? Below is the pseudo code for it nodeA.setMaterial("red", "*"); nodeB.setMaterial("green", "*"); nodeA.addChild(nodeB); I want to this because I have another query on WidgetSpriteNode based on this answer Thanks
  21. I have a DummyNode with a child ObjectMesh, both created via System-script function NewNode(), and the pointers are managed by C++. Child was attached by Unigine::Node::addChild(). I used SetScale() from World script to set parent node scale - all was Ok. BUT. When I moved SetScale() to the System script, it began to set the scale BOTH to parent and child nodes. (C++) - by switching which line, I get different sizes of objects on the scene (of size Scale or Scale^2) ... static void SetScale(NodePtr parentNode, float scale) { //Engine::get()->runSystem("NodeSetScale", Variable("Node",node.get()), Variable(scale)); Engine::get()->runWorld("NodeSetScale", Variable("Node",node.get()), Variable(scale)); } (unigine.cpp) - indeed sets Node's and Node's child scale ... void NodeSetScale(Node node, float scale) { return node.setScale(vec3(scale, scale, scale)); } (Earth.cpp) - indeed sets Node's scale only ... void NodeSetScale(Node node, float scale) { return node.setScale(vec3(scale, scale, scale)); }
  22. [SOLVED] extended Node class

    I'm making a custom class that extends Unigine's WorldTrigger. I find that two of the constructors below cannot "coexist". These would be the second and third constructors - TriggerObject(vec3 size), TriggerObject(string callback). The interpreter does not throw a correct error in the first place, which took me quite some time to figure out that the class can only work with one constructor but not the other. #ifndef MY_OBJECT_H #define MY_OBJECT_H class TriggerObject : WorldTrigger { public: TriggerObject() : WorldTrigger(vec3_one * 2) { setEnterCallback("OnTriggerEnter", this); setLeaveCallback("OnTriggerExit", this); } TriggerObject (vec3 size) : WorldTrigger(size) { } TriggerObject(string callback) : WorldTrigger(vec3_one * 2) { } ~TriggerObject () { delete extern; } void OnTriggerEnter (Node node, TriggerObject instance) { log.message(node.getName() + " entered.\n"); } void OnTriggerExit (Node node, TriggerObject instance) { log.message(node.getName() + " exited.\n"); } }; #endif Has anybody else experienced this? What is wrong with my code?
  23. Editor Nodes

    May we have a section that contains a list of node types that may be added to the editor? When I first got my hand on Unigine a few months ago, I tried adding a PlayerPersecutor class to the editor, which is of course, not possible, leading to an application crash. My workaround back then was to add a NodeDummy whose position and rotation is set from the PlayerPersecutor instance since I only needed to see if the camera goes where I want it to. I'm in the process of upgrading my Unigine copy which now allows a PlayerPersecutor instance to be added to the editor. Thanks.
  24. Related to this post https://developer.unigine.com/forum/topic/1068-acessing-individual-clutter-generated-nodes/ it would be awesome to have some callback system at WorldClutter and WorldCluster classes at every creation/deletion of dynamic nodes (or batch of nodes). This could make these classes more powerful and dynamic. Thanks!
  • Create New...