Advertisement
Guest User

Problem z kolizją

a guest
Aug 18th, 2017
112
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.59 KB | None | 0 0
  1. ARubick::ARubick()
  2. {
  3.     meshPath = "/Game/StarterContent/Shapes/Shape_Sphere.Shape_Sphere";
  4.  
  5.     setMesh();
  6.  
  7.     hierarchy = 1;
  8.    
  9.     pickupSphere = CreateDefaultSubobject<USphereComponent>(TEXT("pickupSphere"));
  10.     pickupSphere->SetWorldScale3D(FVector(1.0f, 1.0f, 1.0f));
  11.     pickupSphere->bGenerateOverlapEvents = true;
  12.     //pickupSphere->OnComponentHit.AddDynamic(this, &ARubick::OnBeginOverlap);
  13.     pickupSphere->AttachToComponent(root, FAttachmentTransformRules::SnapToTargetIncludingScale);
  14.     pickupSphere->OnComponentBeginOverlap.AddDynamic(this, &AItemParent::onBeginOverlap);
  15. //  OnActorBeginOverlap.AddDynamic(this, &ARubick::test);
  16. }
  17.  
  18. void ARubick::OnBeginHit(UPrimitiveComponent* HitComponent, AActor* OtherActor, UPrimitiveComponent* OtherComp, FVector NormalImpulse, const FHitResult& Hit)
  19. {
  20.     GEngine->AddOnScreenDebugMessage(-1, 5.0f, FColor::Red, *(OtherActor->GetName()));
  21. }
  22.  
  23.  
  24.  
  25. #pragma once
  26.  
  27. #include "CoreMinimal.h"
  28. #include "AspectsHierarchy.h"
  29. #include "Rubick.generated.h"
  30.  
  31. UCLASS()
  32. class CARDGAME_API ARubick : public AAspectsHierarchy
  33. {
  34.     GENERATED_BODY()
  35.    
  36. public:
  37.     ARubick();
  38.  
  39. protected:
  40.     // Called when the game starts or when spawned
  41.     virtual void BeginPlay() override;
  42.  
  43. public:
  44.     // Called every frame
  45.     virtual void Tick(float DeltaTime) override;
  46.  
  47.     UPROPERTY(EditAnywhere, BlueprintReadWrite)
  48.         UShapeComponent *pickupSphere;
  49.  
  50.     UFUNCTION()
  51.         void OnBeginHit(UPrimitiveComponent* HitComponent, AActor* OtherActor, UPrimitiveComponent* OtherComp, FVector NormalImpulse, const FHitResult& Hit);
  52.    
  53.     UFUNCTION()
  54.         void test(AActor * myOverlappedActor, AActor *otherActor);
  55. };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement