ImpNode *node = iface->CreateNode(); if (node) { TriObject *tri = CreateNewTriObject(); // Now find the center of the vertices and use that as the pivot int verts = m->getNumVerts(); Point3 accum(0,0,0); for(int i = 0; i < verts; ++i) accum += m->verts[i]; Point3 delta = accum / (float)verts; for(i = 0; i < verts; ++i) m->verts[i] -= delta; tri->mesh = *m; node->Reference(tri); Matrix3 tm; tm.IdentityMatrix(); // Reset initial matrix to identity tm.SetTrans(delta); // Add in the center point node->SetTransform(0,tm); iface->AddNodeToScene(node); node->SetName(n->name); }
#include <impapi.h>