Advertisement
Da_Gamer

UE4 Platform Move 1

Mar 24th, 2016
92
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.53 KB | None | 0 0
  1. // Called every frame
  2. void AMovingPlatform3::Tick( float DeltaTime )
  3. {
  4.      Super::Tick( DeltaTime );
  5.      FVector PlatformLocation = GetActorLocation();
  6.      FVector Start = PlatformLocation;
  7.      FVector End = ???;
  8.      float Duration = 3.0f; // seconds
  9.      
  10.      FVector Delta = (End - Start)/2;
  11.      FVector Origin = Start + Delta/2;
  12.  
  13.      phase = sin(PlatformTime / Duration * 2*pi);
  14.  
  15.      PlatformLocation = Origin + Delta * phase;
  16.  
  17.      PlatformTime += DeltaTime;
  18.  
  19.      SetActorLocation(PlatformLocation);
  20. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement