Hello and thanks for reading. I have an ACharacter with the following basic structure
BaseCharacter Acharacter
Mesh (CharacterMesh0) 3D base skeletal mesh
ClothMesh cloth skeletal mesh
In its constructor I’m setting up a modular character with the Set master Pose Component node, connecting Mesh and ClothMesh.
Mesh (CharacterMesh0) contains the 3d model and ClothMesh points to a “coat” cloth. The coat collides fine against the player that contains it and it also collides correctly with the objects of the environment, this is achieved by following the steps on this guide
https://dev.epicgames.com/community/learning/tutorials/p4a1/unreal-engine-cloth-collision-with-world
(basically enabling Collide with Environment and Force Collision Update on the skeletal meshes)
Like I said it is colliding with the player and the environment, but the coat is not colliding with the other character, and this is taking away the realism from the scene.
By debugging the project I have found that collisions are processed at:
Source : Engine\Source\Runtime\Engine\Private\SkeletalMeshComponentPhysics.cpp
Function : void USkeletalMeshComponent::ProcessClothCollisionWithEnvironment()
Down there it seems they are trying to process collision against another skeletal meshes, I’ll highlight the relevant code below
else if(Channel == ECollisionChannel::ECC_PhysicsBody)
{
// Possibly a skeletal mesh, extract it's clothing collisions if necessary
USkeletalMeshComponent* SkelComp = Cast<USkeletalMeshComponent>(Component.Get());
if(SkelComp && SkelComp->SkeletalMesh)
{
if(SkelComp == this)
{
// Same mesh, move to next component
continue;
}
if(SkelComp->ClothingSimulation) // <-- THIS LINE IS ALWAYS FALSE ... ?
{
// append skeletal component collisions
FClothCollisionData SkelCollisionData;
SkelComp->ClothingSimulation->GetCollisions(SkelCollisionData, false);
NewCollisionData.Append(SkelCollisionData);
}
}
}
by debugging this code above I observe the following
- “this” variable points to ClothMesh, that is, to my coat
- “SkelComp” variable alternates back and forth between the 2 meshes (CharacterMesh0) in the scene
- SkelComp->ClothingSimulation is always null
Why ClothingSimulation is getting a null every time? I think by solving this we can achieve much better clothing sim. Any clue?