Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class MugetsuSpyCameraRightMode extends MugetsuCameraModeBase;
- var float CamOffsetDistance; //distance to offset the camera from the player in unreal units
- var float CamHeight; //how high cam is relative to pawn pelvis
- function bool CameraUpdate( float fDeltaTime, out vector out_CamLoc, out rotator out_CamRot, out float out_FOV, Pawn playerpawn )
- {
- local vector HitLoc,HitNorm, End, Start, vecCamHeight;
- vecCamHeight = vect(0,0,0);
- vecCamHeight.Z = CamHeight;
- Start = playerpawn.Location;
- End = (playerpawn.Location+vecCamHeight) - (Vector(playerpawn.Controller.Rotation)* (CamOffsetDistance));
- out_CamLoc = End;
- //trace to check if cam running into wall/floor
- if(playerpawn.Trace(HitLoc,HitNorm,End,Start,false,vect(12,12,12))!=none)
- {
- out_CamLoc = HitLoc + vecCamHeight;
- }
- //camera will look slightly above player
- out_CamRot=rotator((playerpawn.Location + vector(playerpawn.Rotation)*200*InterpDistSpy(playerpawn.Controller.Rotation, playerpawn) + vecCamHeight) - out_CamLoc);
- return true;
- }
- function float InterpDistSpy(Rotator ViewRot, Pawn playerpawn)
- {
- local Rotator PRot, CRot;
- local float DegAngBetweenPC;
- PRot = rot(0,0,0);
- CRot = rot(0,0,0);
- PRot.Yaw = playerpawn.Rotation.Yaw;
- CRot.Yaw = ViewRot.Yaw;
- DegAngBetweenPC = Class'MugetsuToolBox'.static.GetSignedAngle(Vector(PRot), Vector(CRot), vect(0,0,1));
- if( DegAngBetweenPC < 0 )
- {
- return DegAngBetweenPC/-MugetsuPlayerController(MugetsuPawn(playerpawn).Controller).WallSpyDegree;
- }
- return 0.f;
- }
- DefaultProperties
- {
- CamHeight = 20.0 //40 default value
- CamOffsetDistance= 200.0 //250 default value
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement