inkoalawetrust

Customizable Parallaxing Sky Camera (ZScript)

Mar 5th, 2021 (edited)
226
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.80 KB | None | 0 0
  1. Class ParallaxingSkyboxViewpoint : SkyViewpoint
  2. {
  3.     //$Title Parallaxing Skybox
  4.     //$Category Cameras And Interpolation
  5.     Vector3 startPos;
  6.     int user_skyparallax;
  7.  
  8.     override void BeginPlay ()
  9.     {
  10.         Super.BeginPlay();
  11.  
  12.         user_skyparallax = 16; //Default value so the VM doesn't literally divide by zero.
  13.     }
  14.     override void PostBeginPlay ()
  15.     {
  16.         Super.PostBeginPlay ();
  17.  
  18.         startPos = (self.pos); // Store the starting position
  19.     }
  20.  
  21.     override void Tick()
  22.     {
  23.         super.Tick();
  24.  
  25.         Vector3 playerPos = players[consoleplayer].mo.pos;
  26.         Vector3 newPos = (startPos.x + playerPos.x/user_skyparallax, startPos.y + playerPos.y/user_skyparallax, startPos.z + (playerPos.z/user_skyparallax+0.2));
  27.         SetOrigin(newPos,1);
  28.     }
  29. }
  30.  
Add Comment
Please, Sign In to add comment