Issue with pointer

hello

in “SimpleShooter” Game in Unreal c++ course i try to get EndLine From Gun Class . but it come as zero values

1- here we spawn the gun class


2- after that when player press fire event ,it call pulltTrigger in gun class and take damage so

3- and here the problem the EndLine variable come zeros value

any body have idea why it happen

That’s on a different gun, EndLine would also roughly be where the character got shot is. What are you trying to do?

thanx for replaying

but i don’t understand what mean it’s different gun .
i just don’t understand why the (Endline) return zeros . why it not return this result of calculation in
AGun::PullTrigger()
{
End = Location + Rotation.Vector() * MaxRange;
Endline = End;

Actor->TakeDamage()
}

when i called in AMyCharacter::TakeDamage()
FVector EndLine = Gun->Endline; // here the issue is come zeros value

PullTrigger is called on the gun that did the shooting. TakeDamage is called on the character that got hit by that gun.

Guy1
- Gun1
  - End (0, 0, 0)

Guy2
- Gun2
  - End (0, 0, 0)

// 

Gun1->PullTrigger:
  Gun1->End = (1, 2 ,3)
  HitActor>TakeDamage(...) ; where HitActor == Guy2

Guy2->TakeDamage
 - Gun2->End; still (0,0,0)

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

Privacy & Terms