Download

UMovementComponent won't generate hit event when penetrating

I am implementing a rotating stick that can hit & launch character, but I found that event hit can only be triggered if the character is facing(moving towards) the stick while hit, and can’t do when moving away from it.

I did some research in the code, and found that at Engine\Source\Runtime\Engine\Private\Components\MovementComponent.cpp:573~580, inside UMovementComponent::SafeMoveUpdatedComponent(), the if bracket of handling initial penetrations, both GetPenetrationAdjustment() and MoveUpdatedComponent() does not generate hit event(I assume the only way to proper generate hit event is to call AActor::DispatchBlockingHit() ), although this piece of code actually does the job of resolving a collision/overlap.

I’m c++ beginner and I took really long time to trace this problem, and I currently don’t know how to fix this by myself (I might try manually override this in my own CharacterMovement class). Before I take even longer time to try to fix, I wanna ask first, is there a specific reason to this behavior?