Guest User

Untitled

a guest
Feb 18th, 2019
106
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.84 KB | None | 0 0
  1. // Fill out your copyright notice in the Description page of Project Settings.
  2.  
  3. #include "BaseActor.h"
  4.  
  5.  
  6. // Sets default values
  7. ABaseActor::ABaseActor()
  8. {
  9. // Set this actor to call Tick() every frame. You can turn this off to improve performance if you don't need it.
  10. PrimaryActorTick.bCanEverTick = true;
  11.  
  12. SetRotation(false); //Default is stopped
  13. }
  14.  
  15. // Called when the game starts or when spawned
  16. void ABaseActor::BeginPlay()
  17. {
  18. Super::BeginPlay();
  19. }
  20.  
  21. // Called every frame
  22. void ABaseActor::Tick(float DeltaTime)
  23. {
  24. Super::Tick(DeltaTime); //Call base class
  25. if (isRotating)
  26. {
  27. FRotator tCurrentRotation = GetActorRotation(); //Get Current rotator
  28. tCurrentRotation.Yaw += DeltaTime * Speed; //Change rotation around Z
  29. SetActorRotation(tCurrentRotation); //Set to object
  30. }
  31. }
  32.  
  33. void ABaseActor::SetRotation(bool Rotate)
  34. {
  35. isRotating = Rotate;
  36. }
Add Comment
Please, Sign In to add comment