Hey BEnSon1101,
It helps if you show us some of your code.
Hey BEnSon1101,
It helps if you show us some of your code.
When i shoot towards character anywhere from 1000 units bellow or 1000 units above the character it returns A HIT
i am using LineTraceMultiByChannel and using Custome collisionchannel
**When I shoot near the capsule component or anywhere above or bellow it ** IT COUNTS AS A HIT
would I have to change some replication setting or something
void ACharacter1::Function1_Implementation()
{
TArray<FHitResult> HitResults;
HitResults.Init(FHitResult(ForceInit), 12);
FVector Start = CameraComponent->GetComponentLocation();
FVector ForwardVector = CameraComponent->GetForwardVector();
FVector End = (ForwardVector * 5000) + Start;
FCollisionQueryParams CollisionQueryParams;
CollisionQueryParams.AddIgnoredActor(this);
FCollisionResponseParams ResposeParams(ECollisionResponse::ECR_Block);
GetWorld()->LineTraceMultiByChannel(HitResults, Start, End, ECC_Visibility, CollisionQueryParams, ResposeParams);
if (HitResults.Num() > 0)
{
//CreatBulletHole(&HitResults[0]);
}
for (int x = 0; x != HitResults.Num(); ++x)
{
if (ACharacter* Player = Cast<ACharacter>(HitResults[x].Actor.Get()))
{
GEngine->AddOnScreenDebugMessage(-1, 3.f, FColor::Green, TEXT("Array character"));
FString hMessage = FString::Printf(TEXT("T %f."), HitResults[x].Actor.Get());
GEngine->AddOnScreenDebugMessage(-1, 3.f, FColor::Blue, hMessage);
Player->TakeDamage(-20.f, FDamageEvent(), GetController(), this);
}
}
{
float ACharacter1::TakeDamage(float Damage, FDamageEvent const& DamageEvent, AController * EventInstigator, AActor * DamageCauser)
{
const float ActualDamage = Super::TakeDamage(Damage, DamageEvent, EventInstigator, DamageCauser);
float damageApplied = Health + ActualDamage;
Health = damageApplied;
FString healthMessage = FString::Printf(TEXT("Current Health %f."), Health);
GEngine->AddOnScreenDebugMessage(-1, 3.f, FColor::Blue, healthMessage);
}
Would I need to use a different trace channel
It seems to work when I am not on DEDICATED SERVER
Would this be UE4 bug or something I am doing
**Playing offline works fine it is only multiplayer that it is off
is multi line trace the cause of this behaviour
does anyone know why this is happening