Advertisement
Guest User

RTSCamera.cpp

a guest
Apr 6th, 2015
369
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.34 KB | None | 0 0
  1. // Fill out your copyright notice in the Description page of Project Settings.
  2.  
  3. #include "machines.h"
  4. #include "RTSCamera.h"
  5.  
  6.  
  7. // Sets default values
  8. ARTSCamera::ARTSCamera()
  9. {
  10.     // Set this pawn to call Tick() every frame.  You can turn this off to improve performance if you don't need it.
  11.     PrimaryActorTick.bCanEverTick = true;
  12.  
  13. }
  14.  
  15. // Called when the game starts or when spawned
  16. void ARTSCamera::BeginPlay()
  17. {
  18.     Super::BeginPlay();
  19.    
  20. }
  21.  
  22. // Called every frame
  23. void ARTSCamera::Tick( float DeltaTime )
  24. {
  25.     Super::Tick( DeltaTime );
  26. }
  27.  
  28. // Called to bind functionality to input
  29. void ARTSCamera::SetupPlayerInputComponent(class UInputComponent* InputComponent)
  30. {
  31.     Super::SetupPlayerInputComponent(InputComponent);
  32.  
  33.     check(InputComponent);
  34.     InputComponent->BindAxis("MoveForward", this, &ARTSCamera::MoveForward);
  35.     InputComponent->BindAxis("MoveRight", this, &ARTSCamera::MoveRight);
  36. }
  37.  
  38. void ARTSCamera::MoveForward(float Value)
  39. {
  40.     if (Value != 0.0f)
  41.     {
  42.         UE_LOG(LogTemp, Warning, TEXT("%f"));
  43.         Value;
  44.         // add movement in that direction
  45.         AddMovementInput(GetActorForwardVector(), Value);
  46.     }
  47. }
  48.  
  49. void ARTSCamera::MoveRight(float Value)
  50. {
  51.     //float input = InputComponent->GetAxisValue("MoveRight");
  52.  
  53.     if (Value != 0.0f)
  54.     {
  55.         // add movement in that direction
  56.         AddMovementInput(GetActorRightVector(), Value);
  57.     }
  58. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement