Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ARubick::ARubick()
- {
- meshPath = "/Game/StarterContent/Shapes/Shape_Sphere.Shape_Sphere";
- setMesh();
- hierarchy = 1;
- pickupSphere = CreateDefaultSubobject<USphereComponent>(TEXT("pickupSphere"));
- pickupSphere->SetWorldScale3D(FVector(1.0f, 1.0f, 1.0f));
- pickupSphere->bGenerateOverlapEvents = true;
- //pickupSphere->OnComponentHit.AddDynamic(this, &ARubick::OnBeginOverlap);
- pickupSphere->AttachToComponent(root, FAttachmentTransformRules::SnapToTargetIncludingScale);
- pickupSphere->OnComponentBeginOverlap.AddDynamic(this, &AItemParent::onBeginOverlap);
- // OnActorBeginOverlap.AddDynamic(this, &ARubick::test);
- }
- void ARubick::OnBeginHit(UPrimitiveComponent* HitComponent, AActor* OtherActor, UPrimitiveComponent* OtherComp, FVector NormalImpulse, const FHitResult& Hit)
- {
- GEngine->AddOnScreenDebugMessage(-1, 5.0f, FColor::Red, *(OtherActor->GetName()));
- }
- #pragma once
- #include "CoreMinimal.h"
- #include "AspectsHierarchy.h"
- #include "Rubick.generated.h"
- UCLASS()
- class CARDGAME_API ARubick : public AAspectsHierarchy
- {
- GENERATED_BODY()
- public:
- ARubick();
- protected:
- // Called when the game starts or when spawned
- virtual void BeginPlay() override;
- public:
- // Called every frame
- virtual void Tick(float DeltaTime) override;
- UPROPERTY(EditAnywhere, BlueprintReadWrite)
- UShapeComponent *pickupSphere;
- UFUNCTION()
- void OnBeginHit(UPrimitiveComponent* HitComponent, AActor* OtherActor, UPrimitiveComponent* OtherComp, FVector NormalImpulse, const FHitResult& Hit);
- UFUNCTION()
- void test(AActor * myOverlappedActor, AActor *otherActor);
- };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement