Hello!
I’ve got following problem.
I have Box Collision component, which is being moved by code by SetWorldTransform.
Also I have capsule collision component.
The problem is they invoke BeginOverlap even when they are CLEARLY not overlapping.
(in my case box is sword, and capsule is character, so it’s not CCD probably).
Need help - it’s obviously either bug or some sort of implicit behaviour, of which I’m unaware.
upd. On this picture we can see, that left box in far from reaching right capsule, but still - overlap event generated.
Also tried capsule vs capsule, with same results.
Also discovered, that begin overlap and end overlap happens in the same single frame. Possibly CCD or sweep issue?
FTransform wpnTrans = trans * weaponComponent->GetBoneTransform(0);
collisionComponent->SetWorldTransform(wpnTrans);
collisionComponent->SetWorldScale3D(FVector(1, 1, 1));
Bone transform had scale, so I needed to discard this scale.
I thought, that collision check will happen much later, on some later phase of frame, but it seems like
collision check happens immediately after SetTransform (or SetScale) is called.
So after WorldTransform I had beginOverlap, and after SetWorldScale3D I had EndOverlap.
Code that fixed the issue:
FTransform wpnTrans = trans * weaponComponent->GetBoneTransform(0);
wpnTrans.SetScale3D(FVector(1, 1, 1));
collisionComponent->SetWorldTransform(wpnTrans);
Worked like a charm.
The lesson I’ve learned is that collision checks runs immediately after transforming functions are called.