document.write('
Data hosted with ♥ by Pastebin.com - Download Raw - See Original
  1. AFallingActor::AFallingActor()
  2. {
  3.     // Set this actor to call Tick() every frame.  You can turn this off to improve performance if you don\'t need it.
  4.     PrimaryActorTick.bCanEverTick = true;
  5.  
  6.     //Initialize a StaticMeshComponent
  7.     SM = CreateDefaultSubobject<UStaticMeshComponent>(TEXT("CubeSM"));
  8.  
  9.     //Enable physics so the cube will fall
  10.     SM->SetSimulatePhysics(true);
  11.  
  12.     //You only need to register the OnHit function
  13.     SM->OnComponentHit.AddDynamic(this, &AFallingActor::OnHit);
  14. }
  15.  
  16. void AFallingActor::OnHit(AActor* OtherActor, UPrimitiveComponent* OtherComp, FVector NormalImpulse, const FHitResult& Hit)
  17. {
  18.     GLog->Log(*OtherActor->GetName());
  19. }
  20.  
  21. void AFallingActor::ReceiveHit(UPrimitiveComponent* MyComp, AActor* OtherActor, UPrimitiveComponent* OtherComp, FVector NormalImpulse, const FHitResult& Hit)
  22. {
  23.     GLog->Log(*OtherActor->GetName());
  24. }
');