Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // 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);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement