14{
15 ACharacter* Character = Cast<ACharacter>(SourceActor);
16 if (!Character)
17 {
18 return;
19 }
20
21 UPrimitiveComponent* WeaponMesh = nullptr;
23 {
24 WeaponMesh = CKPlayer->GetWeaponMesh();
25 }
26
27 if (!WeaponMesh)
28 {
29 return;
30 }
31
33 {
34 return;
35 }
36
38 const FVector End = WeaponMesh->GetSocketLocation(
EndSocketName);
39
40 if (Start.Equals(End, 1.0f))
41 {
42 return;
43 }
44
46
47 GetWorld()->SweepMultiByChannel(
48 OutHits, Start, End, FQuat::Identity,
50
51#if ENABLE_DRAW_DEBUG
53 {
54 FColor DrawColor = OutHits.Num() > 0 ? FColor::Green : FColor::Red;
55 FVector Center = Start + (End - Start) * 0.5f;
56 float HalfHeight = (End - Start).Size() * 0.5f;
57 FQuat Rotation = FRotationMatrix::MakeFromZ(End - Start).ToQuat();
58
59 DrawDebugCapsule(GetWorld(), Center, HalfHeight,
TraceRadius, Rotation, DrawColor,
false, 0.1f);
60 }
61#endif
62}
Definition CK_CharacterPlayer.h:20
ECollisionChannel TraceChannel
Definition TA_Trace.h:38
bool bShowDebug
Definition TA_Trace.h:36
Definition TA_WeaponSphereTrace.h:14
FName StartSocketName
Definition TA_WeaponSphereTrace.h:25
FName EndSocketName
Definition TA_WeaponSphereTrace.h:28