This repository was archived by the owner on Jun 19, 2020. It is now read-only.
File tree Expand file tree Collapse file tree 3 files changed +8
-11
lines changed
Source/RMC_Examples/Actors Expand file tree Collapse file tree 3 files changed +8
-11
lines changed Original file line number Diff line number Diff line change @@ -57,24 +57,21 @@ void AAnimatedTerrain::Tick( float DeltaTime )
5757 Generate ();
5858 }
5959
60- float ScaleFactor = 1 .0f ;
61- float AnimationSpeedX = 4 .0f ;
62- float AnimationSpeedY = 4 .5f ;
60+ float AnimationStepX = 5 ;
61+ float AnimationStepY = 6 ;
6362
64- CurrentAnimationFrameX += DeltaTime * AnimationSpeedX ;
65- CurrentAnimationFrameY += DeltaTime * AnimationSpeedY ;
63+ AnimationOffsetX += DeltaTime * AnimationStepX ;
64+ AnimationOffsetY += DeltaTime * AnimationStepY ;
6665
6766
6867 int32 Index = 0 ;
6968 for (int32 YIndex = -HalfWidth; YIndex < HalfWidth; YIndex++)
7069 {
7170 for (int32 XIndex = -HalfWidth; XIndex < HalfWidth; XIndex++)
7271 {
73- float ValueOne = FMath::Cos ((XIndex + CurrentAnimationFrameX)*ScaleFactor) + FMath::Sin ((YIndex + CurrentAnimationFrameY)*ScaleFactor);
74- float ValueTwo = FMath::Cos ((XIndex + CurrentAnimationFrameX*0 .7f )*ScaleFactor*2 .5f ) + FMath::Sin ((YIndex - CurrentAnimationFrameY*0 .7f )*ScaleFactor*2 .5f );
72+ float Scale = FMath::Cos (XIndex + AnimationOffsetX) + FMath::Sin (YIndex + AnimationOffsetY);
7573
76-
77- Positions[Index++].Z = ((ValueOne + ValueTwo) / 2 ) * Height;
74+ Positions[Index++].Z = Scale * Height;
7875 }
7976 }
8077
Original file line number Diff line number Diff line change @@ -30,8 +30,8 @@ class RMC_EXAMPLES_API AAnimatedTerrain : public ARuntimeMeshObjectBase
3030
3131 void Generate ();
3232
33- float CurrentAnimationFrameX = 0 .0f ;
34- float CurrentAnimationFrameY = 0 .0f ;
33+ float AnimationOffsetX = 0 .0f ;
34+ float AnimationOffsetY = 0 .0f ;
3535
3636 int32 HalfWidth = 20 ;
3737
You can’t perform that action at this time.
0 commit comments