Topic: Changing mesh origin via code
I've tried moving all the vertices by the amount that I need. It works but basing on the camera angle sometimes the mesh disappears. I guess it has something to do with normals or text coords?
Any help?
You are not logged in. Please login or register.
I've tried moving all the vertices by the amount that I need. It works but basing on the camera angle sometimes the mesh disappears. I guess it has something to do with normals or text coords?
Any help?
you need to recompute the bounding box
if it's just a translation of vertices, translate the bounding box too.
Oh I had thought that! But then I just confused the bounding box for a collision thing and said "no it doesn't matter" eheh.
For collision it's the collision shape, not the bounding box.
Solved.
I bring up this again because while changing the bounding box does work, I noticed that the entity is not immediately visible until the camera exits and re-enter the new bounding box. I'm wondering what I need to update to avoid this little glitch.
try to use :
// for each sub mesh you modify :
subMesh->getBoundingBox()->initFromPoints(subMesh->getVertices(), subMesh->getVerticesSize());
// then update the mesh :
mesh->updateBoundingBox();
Nope, it doesn't solve it.
so maybe your entity bounding box is not up to date :
*entity->getBoundingBox() = *mesh->getBoundingBox();
That's it, thank you
Powered by PunBB, supported by Informer Technologies, Inc.
Currently installed 3 official extensions. Copyright © 2003–2009 PunBB.