// Called every frame
void AMovingPlatform3::Tick( float DeltaTime )
{
Super::Tick( DeltaTime );
FVector PlatformLocation = GetActorLocation();
FVector Start = PlatformLocation;
FVector End = ???;
float Duration = 3.0f; // seconds
FVector Delta = (End - Start)/2;
FVector Origin = Start + Delta/2;
phase = sin(PlatformTime / Duration * 2*pi);
PlatformLocation = Origin + Delta * phase;
PlatformTime += DeltaTime;
SetActorLocation(PlatformLocation);
}
Comments
0 B
|👍
/👎