Hi,
I Found something interesting, when you import destructible (*.apb) file created in PhysXLab to the engine, the engine will always set materials bEnableShadowCasting flag to false.
This is caused by
bool SetApexDestructibleAsset(UDestructibleMesh& DestructibleMesh, NxDestructibleAsset& ApexDestructibleAsset, FSkeletalMeshImportData* OutData, EDestructibleImportOptions::Type Options)
ExistingDestMeshData * ExistDestMeshDataPtr = SaveExistingDestMeshData(&DestructibleMesh);
//create materials
//create bones
//import influences
//etc
if (ExistDestMeshDataPtr)
{
RestoreExistingDestMeshData(ExistDestMeshDataPtr, &DestructibleMesh);
delete ExistDestMeshDataPtr;
ExistDestMeshDataPtr = NULL;
}
As you see the ExistDestMeshDataPtr is always created and at the end of creation of DestructibleMesh asset old-invalid settings will be restored.
This piece of code:
ExistingDestMeshData * ExistDestMeshDataPtr = SaveExistingDestMeshData(&DestructibleMesh);
should be changed to:
ExistingDestMeshData * ExistDestMeshDataPtr = nullptr;
if ((Options & EDestructibleImportOptions::PreserveSettings))
ExistDestMeshDataPtr = SaveExistingDestMeshData(&DestructibleMesh);
My code takes into account EDestructibleImportOptions::PreserveSettings which is None when you importing destructible asset and set to:
EDestructibleImportOptions::PreserveSettings during reimporting.
Am I right?
Regards
Pierdek