Panakotta00

PlayerControll.cpp

Jul 25th, 2016
89
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.83 KB | None | 0 0
  1. #include "Factorio3D.h"
  2. #include "PlayerControll.h"
  3.  
  4. AActor* PC_Actor;
  5. UWorld* PC_World;
  6. APlayerCameraManager* cm;
  7.  
  8. APlayerControll::APlayerControll() {
  9. PrimaryActorTick.bCanEverTick = true;
  10.  
  11. PC_Actor = Cast<AActor>(this);
  12. PC_World = PC_Actor->GetWorld();
  13.  
  14. cm = PlayerCameraManager;
  15. }
  16.  
  17. void APlayerControll::BeginPlay() {
  18. Super::BeginPlay();
  19. }
  20.  
  21. void APlayerControll::Tick(float DeltaTime) {
  22. Super::Tick(DeltaTime);
  23.  
  24. FVector* c_loc = new FVector();
  25. FVector* c_dir = new FVector();
  26. FHitResult* hit = new FHitResult();
  27. if (DeprojectMousePositionToWorld(*(c_loc), *(c_dir))) {
  28. if (PC_World->LineTraceSingleByChannel(*hit, cm->GetCameraLocation(), *c_loc + *c_dir * 1000, ECC_Pawn) && hit->GetActor()) {
  29. hit->GetActor()->SetActorLocation(hit->GetActor()->GetActorLocation() + *(new FVector(0, 100, 0)));
  30. }
  31. }
  32. }
Add Comment
Please, Sign In to add comment