마우스 커서 사용하기

This commit is contained in:
강민제 2025-04-24 22:51:53 +09:00
parent 8e1f1c0e2a
commit 580ca82639
6 changed files with 38 additions and 12 deletions

File diff suppressed because one or more lines are too long

BIN
Content/Maps/Main.umap (Stored with Git LFS)

Binary file not shown.

View File

@ -23,10 +23,3 @@ ABasePawn::ABasePawn()
ProjectileSpawnPoint = CreateDefaultSubobject<USceneComponent>(TEXT("Projectile Spawn Point")); ProjectileSpawnPoint = CreateDefaultSubobject<USceneComponent>(TEXT("Projectile Spawn Point"));
ProjectileSpawnPoint->SetupAttachment(TurretMesh); ProjectileSpawnPoint->SetupAttachment(TurretMesh);
} }
// Called every frame
void ABasePawn::Tick(float DeltaTime)
{
Super::Tick(DeltaTime);
}

View File

@ -27,9 +27,5 @@ private:
UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category = "Component", meta=(AllowPrivateAccess = "true")) UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category = "Component", meta=(AllowPrivateAccess = "true"))
USceneComponent* ProjectileSpawnPoint; USceneComponent* ProjectileSpawnPoint;
public:
// Called every frame
virtual void Tick(float DeltaTime) override;
}; };

View File

@ -23,12 +23,42 @@ void ATank::SetupPlayerInputComponent(UInputComponent* PlayerInputComponent)
PlayerInputComponent->BindAxis(TEXT("Turn"), this, &ATank::Turn); PlayerInputComponent->BindAxis(TEXT("Turn"), this, &ATank::Turn);
} }
// Called every frame
void ATank::Tick(float DeltaTime)
{
Super::Tick(DeltaTime);
if (PlayerControllerRef)
{
FHitResult HitResult;
PlayerControllerRef->GetHitResultUnderCursor(
ECollisionChannel::ECC_Visibility,
false,
HitResult);
DrawDebugSphere(
GetWorld(),
HitResult.ImpactPoint,
25,
12,
FColor::Green);
}
}
// Called when the game starts or when spawned // Called when the game starts or when spawned
void ATank::BeginPlay() void ATank::BeginPlay()
{ {
Super::BeginPlay(); Super::BeginPlay();
PlayerControllerRef = Cast<APlayerController>(GetController()); PlayerControllerRef = Cast<APlayerController>(GetController());
DrawDebugSphere(
GetWorld(),
GetActorLocation() + FVector(0, 0, 200),
100,
12,
FColor::Red,
false,
30);
} }
void ATank::Move(float Value) void ATank::Move(float Value)

View File

@ -20,6 +20,9 @@ public:
// Called to bind functionality to input // Called to bind functionality to input
virtual void SetupPlayerInputComponent(class UInputComponent* PlayerInputComponent) override; virtual void SetupPlayerInputComponent(class UInputComponent* PlayerInputComponent) override;
// Called every frame
virtual void Tick(float DeltaTime) override;
protected: protected:
// Called when the game starts or when spawned // Called when the game starts or when spawned
virtual void BeginPlay() override; virtual void BeginPlay() override;