Hello ! How to get the skeleton of a Destructible mesh ?
(My final goal is to set the location of the individual chunks, and I think getting the skeleton is the best way to do this, because I have tested to set the locations of the PxActors of the Chunks, and it had awful bugs, the chunks were not at the targeted location. So, if getting the skeleton is not the best way, please tell me)
Thanks, but, my question was about setting the chunks locations, not getting it. I already know there is a SkeletalMesh variable, but, it is only a reference to the mesh we are using, not its real-time instance
Finally, I found out by myself. Yes, there is a function to set the pose, but it’s not the same way :
First, I have to get the PxActor of the Chunk. Then, I have to set its pose.
// These two lines are from Rama
int32 ChunkCount = DestructibleComponent->ApexDestructibleActor->getNumVisibleChunks();
const uint16* ChunkIdxs = DestructibleComponent->ApexDestructibleActor->getVisibleChunks();
for (int32 ThisIdx = 0; ThisIdx < ChunkCount; ThisIdx++)
{
FVector NewChunkLocation = GetActorLocation(); // Set whatever you want here
PxRigidDynamic* PxChunkActor = DestructibleComponent->ApexDestructibleActor->getChunkPhysXActor(ChunkIdxs[ThisIdx]);
PxTransform ChunkTransfrom = PxChunkActor->getGlobalPose(); // Useless beacause the two properties are overriden
ChunkTransfrom.p = PxVec3(NewChunkLocation.X, NewChunkLocation.Y, NewChunkLocation.Z);
ChunkTransfrom.q = PxQuat::createIdentity(); // Rotation has to be zeroed, because otherwise chunks will rotate at a high speed. You can set it, but don't use the actual rotation of the chunk
PxChunkActor->setGlobalPose(ChunkTransfrom);
}
So in order to get the chunks, I need the ApexDestructibleActor, which is always NULL.
Is this ApexDestructibleActor type only available, when I import Apex assets?