Search the Community
Showing results for tags 'vector'.
-
Я начинающий в этом движке и не как ни могу понять как узнать позицию обьекта в пространстве, всю документацию пересмотрел и так и не понял как это сделать. Может я просто не могу найти тот класс который мне нужен? using System; using System.Collections; using System.Collections.Generic; using Unigine; [Component(PropertyGuid = "5ff39bf967441504a8a79c93dfaf78d64f635a3d")] public class Test : Component { private void Update() { Node node = World.GetNodeByName("Cuboid"); float worldPos = (float)node.GetWorldDirection(MathLib.AXIS.X); if (Input.IsKeyUp(Input.KEY.E)) { float TransformX = worldPos + 1.0f; Log.Message("Глобальная позиция:" + worldPos + "\n"); Log.Message("Координаты оси X:" + TransformX +"\n"); node.WorldTranslate(TransformX, 0.0f, 0.0f); } } }
- 2 replies
-
- documentation
- how to?
-
(and 8 more)
Tagged with:
-
Is it possible to delete buildings, roads, and other objects placed by vector data? We're working with a historical time period and will need to ensure that some modern-day roads and city expansions don't make it into our final product. Being unable to do so would mean that we'd have to edit the shape files - not the end of the world, but something important for us to know from a workflow perspective. Also, we plan to use actual geometry for buildings and place them via points. Not sure if that makes a difference. Thanks!
-
Is any way to modify the height of GlobalTerrain by vector files?
liang.hao posted a topic in World Design
Hi, All As the topic, we have to modify the object globalterrain, because our height data isn't satisfied with the building models some kind. And the vector files is more precise, it would meet our needs of urban planning system. -
[SOLVED] Vector of Base class does not append child Class
yigitakkok posted a topic in UnigineScript
Hi, I have a base class called Car. From Car class I have derived p21c class. Then I define a vector: Car cars[]; child = createEntity("p21c"); cars.append(child); When I try to append a child class to this vector in log file it says: Variable::operator<(): bad operands int and user class SOLVED: changing cars.append to car[1] = p21 worked -
Hello Short example: class T { string a; T(string value) { a = value; } }; class My { int _flag = 0; int _test[0]; T _test2 = new T("old"); void test() { log.message("before:\t" + string(_test.size()) + "\t" + _test2.a + "\n"); int local[] = (1); T local2 = new T("temp"); log.message("after:\t" + string(_test.size()) + "\t" + _test2.a + "\n"); local.append(10); _test = local; local2 = new T("new"); _test2 = local2; if (_flag == 0) { _flag = 1; test(); } } } Expected: before: 0 old after: 0 old before: 2 new after: 2 new Real result: before: 0 old after: 0 old before: 2 new after: 1 new
-
So, I have a custom class MyClass. In an event handler I create a vector of these objects like : class EventHandler { MyClass mVector[0]; void addMyClass(MyClass aObject) { mVector.append(aObject). } int findObject(MyClass aObject) { int found = 0; if(mVector.find(aObject, NULL) != NULL) { found = 1; } return found; } }; Adding objects to the vector works with no problems. I can check this by giving each object a unique ID and printing those out. The problem is find(). If the MyObject I'm looking for is at index 0 it then Unigine will not find it. find() works as expected if the object is at any other index, well, so far as I can tell anyhow.
-
So, I have a recursive class function with a map, a vector, and a problem Say the function looks like void foo(MyObject bar) { *do stuff with bar* MyObject childObjectMap[]; bar.getChildren(childObjectMap); // clears childObjectMap then copies all of the child objects into it foreach(MyObject obj; childObjectMap) { foo(obj); } } The expected result is that this will traverse each MyObject, do things with it, then get all it's children objects and repeat recursively. What actually happens is that it only does this with the first child. So, even if each MyObject has five children this will only recurse on the first child of the first child. What I found is happening is that each time the ID of ChildObjectMap remains the same so, in essense, it is static. Everytime I call MyObject::getChildren I'm clobbering it so on the return it has the data from the child. So, the question becomes, how do I create a new map or vector to keep a function from treating a map or vector like a static?
-
Are there any examples of how to return a Unigine::vector<Type> back to UnigineScript? It doesn't appear to work in the way that I would expect. C++ ---MyClass.cpp Unigine::Vector<CustomStruct> &getStruct() { return my_struct; } ---Plugin.cpp ExternClass<MyClass> *my_class= MakeExternClass<MyClass>(); my_class->addConstructor(); my_class->addFunction("getStruct",&MyClass::getStruct); Interpreter::addExternClass("MyClass",my_class); UnigineScript MyClass my_class = new MyClass(); CustomStruct structs[] = my_class.getStruct(); Error: Interpreter::parse_expression_array(): "my_class" is not a user array
-
Hello. Why an error occurs during processing of user class with vector by Reflection Class? For example, I have the following class: class MyClass { private: int myVector[0] = (1, 2, 3); public: MyClass() {} void addItem(int value) { myVector.append(value); } int getItem(int num) { return myVector[num]; } int getNumItems() { return myVector.size(); } }; I use this class in Init() function: int init() { MyClass my_class = new MyClass(); my_class.addItem(4); forloop(int i = 0; my_class.getNumItems()) { log.message("item[%d] = %d;\n", i, my_class.getItem(i)); } /* Output: * item[0] = 1; * item[1] = 2; * item[2] = 3; * item[3] = 4; */ Reflection my_reflection = new Reflection(); my_reflection.reflect(my_class); // here is an error return 1; } And i have following error: Assertion: '(unsigned int)index < (unsigned int)length && "Vector::operator[](): bad index" ' Update: I initialize the vector in constructor, but the probled remained. Then I just declared a variable in the class and the problem disappeared. But this variable is unused. Code: class MyClass { private: int myVector[0]; int i; public: MyClass() { myVector = (1,2,3); } void addItem(int value) { myVector.append(value); } int getItem(int num) { return myVector[num]; } int getNumItems() { return myVector.size(); } };