Data hosted with ♥ by Pastebin.com - Download Raw - See Original
  1. class MugetsuSpyCameraRightMode extends MugetsuCameraModeBase;
  2.  
  3.  
  4. var float CamOffsetDistance; //distance to offset the camera from the player in unreal units
  5. var float CamHeight; //how high cam is relative to pawn pelvis
  6.  
  7. function bool CameraUpdate( float fDeltaTime, out vector out_CamLoc, out rotator out_CamRot, out float out_FOV, Pawn playerpawn )
  8. {
  9.     local vector HitLoc,HitNorm, End, Start, vecCamHeight;
  10.  
  11.     vecCamHeight = vect(0,0,0);
  12.     vecCamHeight.Z = CamHeight;
  13.     Start = playerpawn.Location;   
  14.  
  15.     End = (playerpawn.Location+vecCamHeight) - (Vector(playerpawn.Controller.Rotation)* (CamOffsetDistance));
  16.  
  17.     out_CamLoc = End;
  18.  
  19.     //trace to check if cam running into wall/floor
  20.     if(playerpawn.Trace(HitLoc,HitNorm,End,Start,false,vect(12,12,12))!=none)
  21.     {
  22.         out_CamLoc = HitLoc + vecCamHeight;
  23.     }
  24.  
  25.     //camera will look slightly above player
  26.     out_CamRot=rotator((playerpawn.Location + vector(playerpawn.Rotation)*200*InterpDistSpy(playerpawn.Controller.Rotation, playerpawn) + vecCamHeight) - out_CamLoc);
  27.     return true;
  28. }
  29.  
  30. function float InterpDistSpy(Rotator ViewRot, Pawn playerpawn)
  31. {
  32.     local Rotator PRot, CRot;
  33.     local float DegAngBetweenPC;
  34.     PRot = rot(0,0,0);
  35.     CRot = rot(0,0,0);
  36.     PRot.Yaw = playerpawn.Rotation.Yaw;
  37.     CRot.Yaw = ViewRot.Yaw;
  38.  
  39.     DegAngBetweenPC = Class'MugetsuToolBox'.static.GetSignedAngle(Vector(PRot), Vector(CRot), vect(0,0,1));
  40.  
  41.     if( DegAngBetweenPC < 0 )
  42.     {
  43.         return DegAngBetweenPC/-MugetsuPlayerController(MugetsuPawn(playerpawn).Controller).WallSpyDegree;
  44.     }
  45.  
  46.     return 0.f;
  47. }
  48.  
  49. DefaultProperties
  50. {
  51.         CamHeight = 20.0            //40 default value
  52.         CamOffsetDistance= 200.0        //250 default value
  53. }