Bird wrote:4- I beleve there is anoteh bu it scape me now.
One thing I'm really really desperate for is dynamic shattering of complex meshes. I can do box shapes with using my toolkit
http://www.hurleyworks.com/media/flash/FixedFracturing/FixedFracturing.html But I need to break up a cow, for instance. Can I use Newton do that now? If not, that would be a big priority to me.
How is the speedup of HACD going? That would be a great help to my project as well . I see you've been working on it.
-Bird
you can break the cow or any close maniford mesh using the Mesh effect,
you can actually do better than just that, you can breeak it and have teh iterior painet with a material.
but they is a bug that I do not fixed, bascially after the break of the pat into a tetar herat array, the extrieo has tro be remove, an dI has a bug the was calulation teh wrong UVs.
I try to fixex bu Y realice that si is a mistake to do that, vecaise very lareg object will inevitable run in problems becais eth vorinoi shatte will generate touns and tound of degnerate tertar hedrom.
what I going to do now is to break the mesh into sub meshe and usin eh conve partition.
then sinc eeach enclose body will be a smale set tha is almos conve then teh remove of extreion part become musg simpler.
I will put that to teh end of the list.
The HACD is dont an chek in. if yo usin to laste build you will see teh Camel, an dteh Cow being generated amost intantanuswlly.
here is a code sample code to do it
- Code: Select all
static void LoadCompoundModel_NewtonVersion (const char* const name, DemoEntityManager* const scene, const dVector& origin, int instaceCount)
{
char fileName[2048];
GetWorkingFileName (name, fileName);
NewtonWorld* const world = scene->GetNewton();
dScene compoundTestMesh (world);
compoundTestMesh.Deserialize(fileName);
// freeze the scale and pivot on the model
compoundTestMesh.FreezeScale();
compoundTestMesh.FreezePivot ();
dMeshNodeInfo* mesh = NULL;
for (dScene::dTreeNode* node = compoundTestMesh.GetFirstNode (); node; node = compoundTestMesh.GetNextNode (node)) {
dNodeInfo* info = compoundTestMesh.GetInfoFromNode(node);
if (info->GetTypeId() == dMeshNodeInfo::GetRttiType()) {
mesh = (dMeshNodeInfo*) info;
break;
}
}
_ASSERTE (mesh);
_ASSERTE (mesh->GetMesh());
NewtonMesh* const newtonMesh = mesh->GetMesh();
// create a convex approximation form the original mesh
NewtonMesh* const convexApproximation = NewtonMeshApproximateConvexDecomposition (newtonMesh, 0.2f, 16);
// create a compound collision by creation a convex hull of each segment of the source mesh
NewtonCollision* const compound = NewtonCreateCompoundCollisionFromMesh (world, convexApproximation, 0.001f, 0, 0);
// make a visual Mesh
DemoMesh* const visualMesh = new DemoMesh (newtonMesh);
dMatrix matrix (GetIdentityMatrix());
matrix.m_posit = origin;
for (int ix = 0; ix < instaceCount; ix ++) {
for (int iz = 0; iz < instaceCount; iz ++) {
dFloat y = origin.m_y;
dFloat x = origin.m_x + (ix - instaceCount/2) * 4.0f;
dFloat z = origin.m_z + (iz - instaceCount/2) * 4.0f;
matrix.m_posit = FindFloor (world, dVector (x, y + 10.0f, z, 0.0f), 20.0f); ;
matrix.m_posit.m_y += 2.0f;
CreateSimpleSolid (scene, visualMesh, 10.0f, matrix, compound, 0);
}
}
visualMesh->Release();
NewtonReleaseCollision(world, compound);
NewtonMeshDestroy (convexApproximation);
}
afte I fix these bug and added teh new funtionality, I iwll makd anoteh demo were the Cow an dteh camel can be broken to pieces. how's that?