Da_Gamer icon

UE4 Platform Move 1

Da_Gamer | PRO | 03/24/16 07:02:44 PM UTC | 0 ⭐ | 297 👁️ | Never ⏰ | []
C++ |

530 B

|

None

|

0 👍

/

0 👎

// 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

  •  icon
    01/01/70 12:00:00 AM UTC
    Plain Text |

    0 B

    |

    👍

    /

    👎