I have made it works according to the guide (Unreal Engine CPP Quick Start | Unreal Engine 5.2 Documentation). Thanks for the guide. Though I have few questions about the code:
float RunningTime;
void AFloatingActor::Tick( float DeltaTime )
{
Super::Tick( DeltaTime );
FVector NewLocation = GetActorLocation();
float DeltaHeight = (FMath::Sin(RunningTime + DeltaTime) - FMath::Sin(RunningTime));
NewLocation.Z += DeltaHeight * 20.0f; //Scale our height by a factor of 20
RunningTime += DeltaTime;
SetActorLocation(NewLocation);
}
- Why declear the “float RunningTime” in the .h file rather than .cpp file?
- What DeltaTime means here?
- What FMath::Sin means?
- What Super::Tick( DeltaTime ); means here?
Thanks a lot!