How to make the Camera of UDK (Unreal Developement Kit) Move alone side scrolling? -


i on project space side scrolling game , trying make camera of engine act old space shooter game(move alone , when player pawn stays idle move alone @ edge), tried find tutorials spaceship controller found camera options land units.

my solution overwrite default unreal camera , program own. here quick guide on how accomplish this. it's quite easy, really.

the first step create custom camera class. here:

class mycustomcamera extends camera;  //camera variables var vector mcameraposition; var rotator mcameraorientation; var float mcustomfov;  /**init function of camera */  function initializefor(playercontroller pc) {       super.initializefor(pc);       mcameraposition = vect(0,0,0);       //etc... }  /**update function of camera */ function updateviewtarget(out tviewtarget outvt, float deltatime) {     //this meat of code, here can set camera position @ each      //frame, it's orientation , fov if need (or else really)      outvt.pov.location = mcameraposition;     outvt.pov.rotation = mcameraorientation;     outvt.pov.fov = mcustomfov; } 

the next , last step set new custom camera default one. so, in playercontroller class add defaultproperties block:

cameraclass=class'mycustomcamera' 

now specific need of "scrolling" camera, simple in update function :

/**update function of camera */ function updateviewtarget(out tviewtarget outvt, float deltatime) {     //this meat of code, here can set camera position @ each      //frame, it's orientation , fov if need (or else really)      //this make camera move on x axis @ speed 50 units per second.     mcameraposition += vect(50*deltatime,0,0);      outvt.pov.location = mcameraposition;     outvt.pov.rotation = mcameraorientation;     outvt.pov.fov = mcustomfov; } 

hope gets started!


Comments

Popular posts from this blog

javascript - Count length of each class -

What design pattern is this code in Javascript? -

hadoop - Restrict secondarynamenode to be installed and run on any other node in the cluster -