SnippetPrunerSerialization doesn't work well

Hi,

I am checking SnippetPrunerSerialization and I founded that the function createStackWithSerializedPrunerStructure() doesn’t create anything.

It seems that PxCollectionExt::releaseObjects(*collection1); from line 187 of the cpp removes all of the actors from the Scene. I tried to modify it but I can not only remove the pruning structure but leave the actors.

Thanks for any advise!

Hi,
yes, this is correct. It would remove all those actors.

You might want to remove just the pruning structure with a code like this:
for(PxU32 i = 0; i < collection1->getNbObjects(); i++)
{
if(collection1->getObject(i).is())
{
collection1->getObject(i).release();
collection1->remove(collection1->getObject(i));
break;
}
}

You need to release the pruning structure before the actors. So make sure you call the release on the pruning structure inside the collection, then it should be fine.

Regards,
Ales

Thanks AlesBorovicka! It works very well.