Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include "Factorio3D.h"
- #include "PlayerControll.h"
- AActor* PC_Actor;
- UWorld* PC_World;
- APlayerCameraManager* cm;
- APlayerControll::APlayerControll() {
- PrimaryActorTick.bCanEverTick = true;
- PC_Actor = Cast<AActor>(this);
- PC_World = PC_Actor->GetWorld();
- cm = Cast<APlayerCameraManager>(this);
- }
- void APlayerControll::BeginPlay() {
- Super::BeginPlay();
- }
- void APlayerControll::Tick(float DeltaTime) {
- Super::Tick(DeltaTime);
- FVector* c_loc = new FVector();
- FVector* c_dir = new FVector();
- FHitResult* hit = new FHitResult();
- if (DeprojectMousePositionToWorld(*(c_loc), *(c_dir))) {
- if (PC_World->LineTraceSingleByChannel(*hit, cm->GetCameraLocation(), *c_loc + *c_dir * 1000, ECC_Pawn)) {
- hit->GetActor()->SetActorLocation(hit->GetActor()->GetActorLocation() + *(new FVector(0, 100, 0)));
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement