2013-07-10 2 views
0

나는 공간면 스크롤링 게임 프로젝트를하고 있으며, 우주 비행사 게임과 같은 엔진 동작 카메라를 만들려고 노력하고있다. (혼자 움직여야하고 플레이어 폰이 공회전 할 때 혼자 움직이게된다.) 나는 우주선 컨트롤러에 대한 튜토리얼을 찾으려고했지만 토지 유닛 전용 카메라 옵션을 찾았습니다.UDK (Unreal Developement Kit)의 카메라를 만드는 방법 혼자서 스크롤을 이동 하시겠습니까?

답변

0

내 솔루션은 기본 Unreal 카메라를 덮어 쓰고 자신 만의 프로그램을 작성하는 것입니다. 다음은이를 수행하는 방법에 대한 빠른 안내서입니다. 정말 쉽습니다.

첫 번째 단계는 사용자 정의 Camera 클래스를 만드는 것입니다. 여기 는 :

class MyCustomCamera extends Camera; 

//Camera variables 
var Vector mCameraPosition; 
var Rotator mCameraOrientation; 
var float mCustomFOV; 

/**Init function of the camera 
*/ 
function InitializeFor(PlayerController PC) 
{ 
     Super.InitializeFor(PC); 
     mCameraPosition = Vect(0,0,0); 
     //Etc... 
} 

/**Update function of the camera 
*/ 
function UpdateViewTarget(out TViewTarget OutVT, float DeltaTime) 
{ 
    //This is the meat of the code, here you can set the camera position at each 
    //frame, it's orientation and FOV if need be (or anything else really) 

    OutVT.POV.Location = mCameraPosition; 
    OutVT.POV.Rotation = mCameraOrientation; 
    OutVT.POV.FOV = mCustomFOV; 
} 

다음과 마지막 단계는 기본적으로 하나가 될 새 사용자 정의 카메라를 설정하는 것입니다. 당신이 추가하려면하는 PlayerController 클래스에서 이렇게하려면하면 defaultproperties 블록입니다 :

CameraClass=class'MyCustomCamera' 

는 이제 "스크롤"카메라의 특정 요구를 들어, 당신이 당신의 업데이트 기능이 같은 간단한을 할 수

:

/**Update function of the camera 
*/ 
function UpdateViewTarget(out TViewTarget OutVT, float DeltaTime) 
{ 
    //This is the meat of the code, here you can set the camera position at each 
    //frame, it's orientation and FOV if need be (or anything else really) 

    //This will make your camera move on the X axis at speed 50 units per second. 
    mCameraPosition += Vect(50*DeltaTime,0,0); 

    OutVT.POV.Location = mCameraPosition; 
    OutVT.POV.Rotation = mCameraOrientation; 
    OutVT.POV.FOV = mCustomFOV; 
} 

희망은 시작됩니다.