Pawn와 PlayerController에서 카메라 계산을 하는것 말고
카메라 클래스를 만들어 시점을 구현하고 싶습니다.
튜토리얼을 보면서 카메라 클래스에 아래와같이 숄더캠 같은것을 구현해놓긴 했는데..
막상 게임을 실행하고 어떻게 이걸 적용해야될지 모르겠네요
당연히 이게 어떻게 작동하는지도 모르겠고요
이 카메라 클래스를 내가 컨트롤할수있게 하는 방법을 알고싶습니다.
카메라 클래스를 만들어 시점을 구현하고 싶습니다.
튜토리얼을 보면서 카메라 클래스에 아래와같이 숄더캠 같은것을 구현해놓긴 했는데..
막상 게임을 실행하고 어떻게 이걸 적용해야될지 모르겠네요
당연히 이게 어떻게 작동하는지도 모르겠고요
Code:
class GPCamera extends Camera; var float Dist, TargetFov, Z, TargetZ, Offset, TargetOffset, pival; var GPPlayerController PlayerOwner; function PostBeginPlay() { Super.PostBeginPlay(); `log("GPCamera 18: PostBeginPlay"); } //소유하는 PlayerController에 대한 PlayerCamera 초기화 function InitializeFor(PlayerController PC) { Super.InitializeFor(PC); PlayerOwner = GPPlayerController(PC); } function UpdateViewTarget(out TViewTarget OutVT, float DeltaTime) { local Vector Loc, Pos, HitLocation, HitNormal; local Rotator Rot; local Actor HitActor; local CameraActor CamActor; local TPOV OrigPOV; OrigPOV = OutVT.POV; //store previous POV, in case we need it later OutVT.POV.FOV = DefaultFOV; //기본 FOV CamActor = CameraActor(OutVT.Target); //카메라 액터를 통해 보기 if(CamActor != None) { CamActor.GetCameraView(DeltaTime, OutVT.POV); //<---Grap aspect ratio from the CameraActor---> bConstrainAspectRatio = bConstrainAspectRatio || CamActor.bConstrainAspectRatio; OutVT.AspectRatio = CamActor.AspectRatio; //<---See if the CameraActor wants to override the postprocess settings used.---> CamOverridePostProcessAlpha = CamActor.CamOverridePostProcessAlpha; CamPostProcessSettings = CamActor.CamOverridePostProcess; } else { //Pawn ViewTarget에 카메라 위치를 기술할 기회 제공 //Pawn이 카메라 뷰를 오버라이딩하지 않으면, 기본값으로 진행 if( Pawn(OutVT.Target) == None || !Pawn(OutVT.Target).CalcCamera(DeltaTime, OutVT.POV.Location, OutVT.POV.Rotation, OutVT.POV.FOV) ) { switch( CameraStyle ) { case 'Fixed' : OutVT.POV = OrigPOV; break; case 'ThirdPerson' : case 'FreeCam' : case 'ShoulderCam' : Loc = OutVT.Target.Location; Rot = OutVT.Target.Rotation; if(CameraStyle == 'ThirdPerson') { Rot = PCOwner.Rotation; TargetZ = 0; TargetFov = 90; TargetOffset = 0; } if(CameraStyle == 'ShoulderCam') { Rot = PCOwner.Rotation; FreeCamDistance = 64; TargetFOV = 60.0f; TargetZ = 32; TargetOffset = 32; } if(CameraStyle == 'FreeCam') { Rot = PCOwner.Rotation; } Loc += FreeCamoffset >> Rot; Loc.Z += Z; if(Dist != FreeCamDistance) { Dist = Lerp(Dist, FreeCamDistance, 0.15); } if(Z != TargetZ) { Z = Lerp(Z, TargetZ, 0.1); } if(DefaultFOV != TargetFOV) { DefaultFOV = Lerp(DefaultFOV, TargetFOV, 0.1); } if(Offset != TargetOffset) { Offset = Lerp(Offset, TargetOffset, 0.1); } Pos = Loc - Vector(Rot) * Dist; Pos.X += Offset * sin(-Rot.Yaw * pival * 2 / 65536); Pos.Y += Offset * cos(Rot.Yaw * pival * 2 / 65536); HitActor = Trace( HitLocation, HitNormal, Pos, Loc, False, vect(12,12,12) ); OutVT.POV.Location = (HitActor == None) ? Pos : HitLocation; OutVT.POV.Rotation = Rot; break; default : OutVT.Target.GetActorEyesViewPoint(OutVT.Pov.Location, OutVT.Pov.Rotation); break; }//switch end }//if end }// else end ApplyCameraModifiers(DeltaTime, OutVT.POV); } defaultproperties { FreeCamDistance = 192.0f pival = 3.14159; }
이 카메라 클래스를 내가 컨트롤할수있게 하는 방법을 알고싶습니다.
Comment