a.koryakin Posted September 9, 2015 Share Posted September 9, 2015 Hi All I'm rtying to add vector in map like this:int Events[] ; Events.append(ivec3(1,1,1)); Events.append(ivec3(2,2,2)); // this vector was added Events.append(ivec3(2,3,4)); // this vector was not added log.message(" size = %i \n", Events.size());message: size = 2What am i doing wrong? i want to add all three vectors. Link to comment
silent Posted September 9, 2015 Share Posted September 9, 2015 Hi Alexander, If you want to fill map with key and value you can try to use append(key, value) method: Events.append(1, ivec3(1,1,1)); Events.append(2, ivec3(2,2,2)); Events.append(3, ivec3(2,3,4)); We will also investigate further your use-case. Probably, there is some incorrect behavior appears. Thanks! How to submit a good bug report --- FTP server for test scenes and user uploads: ftp://files.unigine.com user: upload password: 6xYkd6vLYWjpW6SN Link to comment
a.koryakin Posted September 10, 2015 Author Share Posted September 10, 2015 The point is i want to use ivec3 as a key for mapEvents.append(ivec3(1,1,1), 1); Events.append(ivec3(2,2,2), 2); Events.append(ivec3(2,3,4), 3);Documentation says i can use variable type as a key and ivec3 is a variable void append(variable key) void append(variable key, variable value) Link to comment
silent Posted September 10, 2015 Share Posted September 10, 2015 Hi Alexander, It seems the there is small bug in Mathlib. It was already fixed in our internal builds. The bug fix will be available in the next SDK update. Sorry for the inconvenience caused. How to submit a good bug report --- FTP server for test scenes and user uploads: ftp://files.unigine.com user: upload password: 6xYkd6vLYWjpW6SN Link to comment
silent Posted September 15, 2015 Share Posted September 15, 2015 Hi Alexander, A small update. We are deeply sorry, but mentioned before fix will not be included in the next SDK update. Unigine Map container internally uses binary tree to add elements into it, so the comparison operator is required for all kind of objects that should be added into this Map. Unfortunately, there is no correct way to compare vectors, so you can override "<" method for vector in UnigineScript code and write some custom vector compare logic: class OurMapCompontent { int x; int y; int z; OurMapCompontent(ivec3 vector) { x = vector.x; y = vector.y; z = vector.z; } int operator<(OurMapCompontent other) { // Your comprasion code for vector // ... } }; Sorry for the incovenience caused. How to submit a good bug report --- FTP server for test scenes and user uploads: ftp://files.unigine.com user: upload password: 6xYkd6vLYWjpW6SN Link to comment
Recommended Posts