Hello,
I use unigine sim 2.0, when i use addColor() function of ObjectMeshDynamic class it can not work,the code like below:
int init() { ObjectMeshDynamic mesh = new ObjectMeshDynamic(); // Create a dynamic mesh and add it into the editor. engine.editor.addNode(node_remove(mesh)); mesh.setWorldTransform(translate(Vec3(0.0f,0.0f,2.0f))); mesh.setMaterial("mesh_base","*"); mesh.setProperty("surface_base","*"); mesh.addTriangleQuads(1); // Allocate space in a vertex buffer and create vertex indices. mesh.addVertex(vec3(-1.0f,-1.0f,0.0f)); // Add vertices and assign texture coordinates, if necessary. mesh.addColor(vec4(1,0,0,1)); mesh.addVertex(vec3(1.0f,-1.0f,0.0f)); mesh.addColor(vec4(1,1,0,1)); mesh.addVertex(vec3(1.0f,1.0f,0.0f)); mesh.addColor(vec4(1,1,1,1)); mesh.addVertex(vec3(-1.0f,1.0f,0.0f)); mesh.addColor(vec4(0,0,0,1)); mesh.updateTangents(); // Calculate tangent vectors. mesh.updateIndices(); // Optimize vertex and index buffers, if necessary. mesh.updateBounds(); // Calculate a mesh bounding box. return 1;}
How can i use it for work?
Thanks.