Problems with collisions

Hi, I´m having problems with the NPC that doesn´t shoot me correctly:
imagen
As you can see shoot off set and doesn´t do to me any damage. I have the same problem as the player that I don´t hit the NPC and don´t get any log message.

Advancing in the course I realize that doens´t affect the health bar at all, so the character isn´t recieving any damage.

What is happening? Thanks

Have you logged out the names of what the line trace is hitting?

Yes I follow the Debug line in the class of ray tracing and haven´t any problem.

Perhaps you may have misunderstood? I was asking how have you tried debugging your issue so far.

I try with the debug line that we saw in the class and also finishing the course waiting to see if that will help solving the problem.

What I’m suggesting is you log out the names of what the line trace hits.

bool bSuccess = GetWorld()->LineTraceSingleByChannel(Hit, Location, End, ECollisionChannel::ECC_GameTraceChannel1, Params);
if (bSuccess)
{
    UE_LOG(LogTemp, Warning, TEXT("Hit %s"), *AActor::GetDebugName(Hit.GetActor()))

Hi, with that debug line the player and NPC are hit, but doesn´t suffer damage:
imagen

thanks for the help, what else could be wrong?

Well my next point of action would be logging just before calling take damage

FPointDamageEvent DamageEvent(Damage, Hit, ShotDirection, nullptr);

UE_LOG(LogTemp, Warning, TEXT("%s Hit %s"), *GetName(), *HitActor->GetName())
HitActor->TakeDamage(Damage, DamageEvent, OwnerController, this);

I put it here:


Ando also this see I have this other UE_LOG:
imagen
And none of them gime me information in the output log.

Odd, and then if you move that first log to before the if?

I can´t neither before that if or the first one:


I meant after the declaration of HitActor

It gives me the same log as before.

That’s weird, did you use AActor::GetDebugName before? That difference is that it will print Null if the actor is nullptr. So I’m wondering why it’s somehow both null and not null.

No, first time I listen of that function. If you told me how to used it I can give it a try. Thanks for your help by the way

I already posted it

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.

Privacy & Terms