Results 1 to 13 of 13
  1. #1

    Default How to make it? UnrealScript 3rd person camera

    hello everyone!
    I have one question about of use Unreal Script
    /* Just do not scold me, I'm only 13 and I'm from Russia and teach English only. Although C ++, I already know English better: P */

    I have "3rd person camera" - Camera zoom, aim, player movement, etc But I do not understand how to connect it.

    can someone help a little "lesson" - "how to do it?"

    UPD
    to begin .. need to edit DefaultEngine.ini and add
    +EditPackages=DSGame
    and DefaultGame.ini
    DefaultGame=DSGame.DSGameinfo
    DefaultServerGame=DSGame.DSGameinfo
    PlayerControllerClassName=DSGame.DSPlayerControlle r
    But what to do next, I do not know
    To be precise, I do not know what to "bind" in DefaultInput.ini
    I did not understand what the author wanted to say about the

    -A quick note - the UT script doesn't use your PlayerCamera.uc, so if you're not building off of UT, read the first link in my credits to learn about setting up your PlayerCamera.
    Last edited by Diazman; 07-03-2012 at 11:37 AM.

  2. #2
    Redeemer
    Join Date
    Jul 2011
    Location
    London, UK
    Posts
    1,765

    Default

    http://udn.epicgames.com/Three/Camer...icalGuide.html this should help, btw next time post this in the programming section you'll get more replies there,

  3. #3

    Default

    I saw this article, but did not find an answer, maybe I'm just too young to understand that: (

  4. #4
    Redeemer
    Join Date
    Jul 2011
    Location
    London, UK
    Posts
    1,765

    Default

    No no you are not too young, one question what exactly do you want ? can you explain please ? thanks,

  5. #5

    Default

    Ok
    1) How bind keys for this script
    2) need to edit DefaultEngine.ini and add
    +EditPackages=DSGame
    and DefaultGame.ini
    DefaultGame=DSGame.DSGameinfo
    DefaultServerGame=DSGame.DSGameinfo
    PlayerControllerClassName=DSGame.DSPlayerControlle r
    Is that right? =) or it does not need?

    3) and now the error :-(

    [0008.14] --------------------DSGame - Release--------------------
    [0008.14] Analyzing...
    [0008.17] D:\game\Engine\UDK\Development\Src\DSGame\Classes\ DSHUD.uc(65) : Error, Unknown Function 'GetCursorPosition' in 'Class Engine.UIRoot'
    [0008.17] D:\game\Engine\UDK\Development\Src\DSGame\Classes\ DSHUD.uc(31) : Error, Unrecognized member 'SetMousePosition' in class 'GameUISceneClient'
    [0008.19] Compile aborted due to errors.
    [0008.23]
    [0008.23] Warning/Error Summary
    [0008.23] ---------------------
    [0008.23] D:\game\Engine\UDK\Development\Src\DSGame\Classes\ DSHUD.uc(65) : Error, Unknown Function 'GetCursorPosition' in 'Class Engine.UIRoot'
    [0008.23] D:\game\Engine\UDK\Development\Src\DSGame\Classes\ DSHUD.uc(31) : Error, Unrecognized member 'SetMousePosition' in class 'GameUISceneClient'
    [0008.23]
    [0008.23] Failure - 2 error(s), 0 warning(s)
    [0008.23]
    Execution of commandlet took: 5.68 seconds
    Last edited by Diazman; 07-03-2012 at 12:14 PM.

  6. #6
    Redeemer
    Join Date
    Jul 2011
    Location
    London, UK
    Posts
    1,765

    Default

    Diazman, which version of UDK are you using ? it seems like those codes are outdated and that is why you get errors,

  7. #7

    Default

    May 2012 UDK Beta

    and post deanh22a, 03-21-2010... okay, but I still did not understand what to write in DefaultInput.ini
    Last edited by Diazman; 07-03-2012 at 01:17 PM.

  8. #8
    Redeemer
    Join Date
    Jul 2011
    Location
    London, UK
    Posts
    1,765

    Default

    Alright first of all create a folder called DSGame then inside that folder create another folder called classes, after that go on defaultengine.ini where you see [UnrealEd.EditorEngine] write +EditPackages=DSGame, now you done that use those codes here i modified them to make it work with UDK newer versions it actually compiles with March 2012 give it a try with May 2012 UDK,

    hope i haven't missed any code,

    Code:
    class DSHUD extends UTHUD;
    
    var texture2D CursorTexture;
    var Vector2D MousePosition;
    
    //------------------------------------------------------------
    
    event PostRender()
    {
        local DSPlayerController PC;                  //This will hold the player controller
        local Vector      MouseHitWorldNormal;        //Hold the normalized vector of world location to get direction to MouseHitWorldLocation (calculated in HUD, not used)
        local Vector      MousePosWorldLocation;      //Hold deprojected mouse location in 3d world coordinates. (calculated in HUD, not used)
        local Vector      MousePosWorldNormal;        //Hold deprojected mouse location normal. (calculated in HUD, used for camera ray from above)
    
        local vector      StartTrace;                 //Hold calculated start of ray from camera
        local Vector      EndTrace;                   //Hold calculated end of ray from camera to ground
        local vector      RayDir;                     //Hold the direction for the ray query.
        local Actor       TraceActor;                 //If an actor is found under mouse cursor when mouse moves, its going to end up here.
    
        super.PostRender();                           //do UTHud.PostRender
        PC = DSPlayerController(PlayerOwner);         //Set PC as DSPlayerController version of the PlayerOwner
        PC.resolution.x =  (Canvas.ClipX) ;           //find the screen resolution.
        PC.resolution.y =  (Canvas.ClipY);
    
        if (PC.CameraZoom >1)  //if not in first person zoom
        {
    
            //this code traces from the camera's location to where your cursor touches something in 3d space so your pawn can aim and shoot at it.
    
            if (PC.CameraZoom == 2)// if third person locked aim, center cursor on screen
    //           PlayerOwner.GetUIController().SceneClient.SetMousePosition(PC.resolution.x/2,PC.resolution.y/2);
            MousePosition = getMouseCoordinates();  //find the cursor coordinates
    	Canvas.DeProject(MousePosition, MousePosWorldLocation, MousePosWorldNormal); //find the cursor 3d location and direction
    	RayDir = MousePosWorldNormal;
    	StartTrace = (PC.PCCameraLoc) + RayDir;  //where to start the trace from
    	EndTrace = StartTrace + RayDir * 5000;    //where to end the trace
    	TraceActor = Trace(PC.MouseHitWorldLocation, MouseHitWorldNormal, EndTrace, StartTrace, true) ; //trace the line, see if it hits anything. store in MouseHitWorldLocation
            if (TraceActor == PC.pawn)   //if the line hit your pawn
     	   TraceActor = Trace(PC.MouseHitWorldLocation, MouseHitWorldNormal, EndTrace, StartTrace, false) ;  //search again, ignoring actors. Don't want to be shooting at yourself
    	if (PC.MouseHitWorldLocation == vect(0,0,0))  //if the trace doesn't hit anything
    	   PC.MouseHitWorldLocation = EndTrace;            // use the end trace location so you'll have somewhere to aim
            //self.DrawDebugLine(PC.pawn.location, PC.MouseHitWorldLocation, 1, 255, 1, false);   //debug line to use if needed
    	//PC.PawnEyeLocation = Pawn(PlayerOwner.ViewTarget).Location + Pawn(PlayerOwner.ViewTarget).EyeHeight * vect(0,0,1) ;  //Calculate the pawn eye location for debug ray and for checking obstacles on click.
    
        }//if (PC.CameraZoom >1)  //if not in first person zoom
    } //event PostRender()
    
    //------------------------------------------------------------
    
    function DrawHUD() 
    {
        ConfiguredCrosshairScaling = 0.0;     //get rid of the crosshair
        super.DrawHUD();                      //run UTHud.DrawHud
        MousePosition = getMouseCoordinates();//get the mouse position
        drawCursor();                         //execute Drawcursor() in DSHud
    }  //function DrawHUD()
    
    //------------------------------------------------------------
    
    function Vector2D getMouseCoordinates() //this function returns the mouse coordinates
    {
        local IntPoint ScreenPos;
        local vector2d MousePos;
    
    //    class'UIRoot'.static.GetCursorPosition(ScreenPos.X , ScreenPos.Y);
    
        MousePos.X = float(ScreenPos.X);
        MousePos.Y = float(ScreenPos.Y);
    
        return MousePos;
    } //function Vector2D getMouseCoordinates()
    
    //------------------------------------------------------------
    
    function drawCursor() //this will draw the cursor where needed
    {
    
        Canvas.SetDrawColor(255, 255, 255, 255);  //set the draw color
        if (DSPlayerController(PlayerOwner).CameraZoom > 2) //if not in a locked aim mode
           Canvas.SetPos((MousePosition.X - 16), (MousePosition.Y-16));   //our position will be where the mouse cursor is
        else  // if in a locked aim mode, draw the cursor at the center of the screen. (our crosshair)
            Canvas.SetPos(DSPlayerController(PlayerOwner).resolution.x/2-16,DSPlayerController(PlayerOwner).resolution.y/2-16);
        Canvas.DrawTile(CursorTexture, 32 , 32, 126, 0, 64,64);  //draw the cursor
    }
    
    //------------------------------------------------------------
    
    defaultproperties
    {
        CursorTexture=Texture2D'UI_HUD.HUD.UTCrossHairs'   //set the crosshair image
    }

    Code:
    class DSPlayerController extends UTPlayerController;
    
    //var Vector      PawnEyeLocation;            //Hold location of pawn eye for rays that query if an obstacle exist to destination to pathfind.
    var rotator PCCameraRot;     //keeps track of the player controller camera rotation
    var vector PCCameraLoc;      //keeps track of the player controller camera Location
    var float PCCameraOrbit;     //this is only the camera orbit that the player wants. Not the actual yaw or location of the camera.
    var int CameraZoom;          //which camera mode you are in
    var Vector MouseHitWorldLocation;      //Hold where the ray casted from the mouse in 3d coordinate intersect with world geometry.
    var Vector2D         resolution;       //the screen resolution
    var bool bCamRotating;                 //is the player rotating the camera? (orbiting the player)
    
    //---------------------------------------------------------------------------------------------------
    
    exec function PrevWeapon()  //lower camerazoom. to make it easy, we'll just use this to change camera modes. normally you'd make your own function in your PlayerInput Class
    {
       if (CameraZoom > 1 && !bCamRotating) //if higher than mode 1 and the player is not rotating the camera
       {
          if (CameraZoom == 2)  //in mode 2, about to switch to mode 1
          {
           Camera('1st'); //tells the camera to switch to first person
           PCCameraLoc =  Pawn.location ;   //set PCCameraLoc to the pawn's position
           PCCameraRot =  pawn.GetBaseAimRotation() ;  //set PCCameraRot to the pawn's Rotation
           PCCameraRot.roll = 0;  //keep roll at 0
           setLocation(PCCameraLoc);  //set the Player controller's location to PCCameraLoc
           setrotation(PCCameraRot);   //set the Player controller's rotation to PCCameraRot
          } //if (CameraZoom == 2)  //in mode 2, about to switch to mode 1
    
       CameraZoom--;    // reduce the camera mode by 1
    
       } //if (CameraZoom > 1
    } //exec function PrevWeapon()
    //---------------------------------------------------------------------------------------------------
    exec function NextWeapon() //raise camerazoom. to make it easy, we'll just use this to change camera modes. normally you'd make your own function in your PlayerInput Class
    {
     if (CameraZoom < 6 && !bCamRotating)//if lower than camera mode 6 and not rotating the camera
     {
        Camera('3rd'); //Just in case the camera fell into 1st person somehow, make sure its in 3rd
        if (CameraZoom == 1)    // in first person. returning to third person locked aim
           Camera('3rd');
    
        if (CameraZoom == 2)    //in third person locked aim. returning to third person free aim
            PCCameraOrbit = (Rotation.Yaw   *UnrRotToRad ) * RadToDeg; //updates PCCameraOrbit so that it's behind the player.
    
        CameraZoom++;  //raise camerazoom by one
    
     }  // if (CameraZoom < 6 && !bCamRotating
    }//exec function NextWeapon()
    
    //---------------------------------------------------------------------------------------------------
    
    simulated event GetPlayerViewPoint( out vector POVLocation, out Rotator POVRotation )//tell them where our camera should be
    { //the outs mean these variables are changed and go back out to whatever called the function
    
        //the UT script handles the camera stuff, so we don't use an actual playercamera.ut here. Instead, we simply tell
        //the game where we want our playerviewpoint ("camera" location) to be.
    
       local float     distance, curdistance; //these variables are explained in UpdateRotation( float DeltaTime )
       local vector	   CamAimLoc,FinalPos;
       local rotator   CamRotation;
    
       if (CameraZoom > 2) //free aim modes
       {
         if(Pawn == None)  //if pawn does not exist
                 super.GetPlayerViewPoint(POVLocation, POVRotation);
         else     //if pawn exists
         {
        
             POVLocation =  PCCameraLoc;  //send back PCCamera information
             POVRotation =   PCCameraRot;
             setrotation(PCCameraRot);     //make sure the PlayerController is at the same place as the playerviewpoint
             setLocation(PCCameraLoc);
         }   //else
      
       }// if (CameraZoom > 2)//free aim modes
    
    
       if (CameraZoom == 1)   //first person
       {
         super.GetPlayerViewPoint( POVLocation, POVRotation );
         PCCameraLoc = POVLocation;       //run regular UT script and update PCCamera information as the player moves.
         PCCameraRot = POVRotation;
         
       }
       
        if (CameraZoom == 2)  //third person locked aim
        {    //to make this mode work, I had to configure the camera here, instead of update rotation. I wasn't worried about the interpolation.
             //these stuff is explained in UpdateRotation( float DeltaTime )
    
             CamRotation = Rotation;
             distance = 50;
             CamAimLoc.X = 0;   //front to back
             CamAimLoc.Y =  0;  //-aim to the left  +aim to the right
             CamAimLoc.Z =  60;  // up and down
    
             CamAimLoc.X += Pawn.Location.X;
             CamAimLoc.Y += Pawn.Location.Y;
             CamAimLoc.Z += Pawn.Location.Z;
    
             curdistance = VSize( Location -  CamAimLoc);
    
             if(curdistance != distance)
             distance = lerp(curdistance, distance, 0.2);
    
             FinalPos = CamAimLoc - Vector(CamRotation) * Distance;
    
             POVLocation =  FinalPos;  //send back this information
             POVRotation =   CamRotation;
    
             // setrotation(CamRotation);  //doesnt need to be set
             setLocation(FinalPos);         //make sure the PlayerController is at the same place as the playerviewpoint will be
             PCCameraRot =  CamRotation;   //make sure the PCCamera information is at the same place as the playerviewpoint will be
             PCCameraLoc =  FinalPos;      //I love lamp
    
        }  //if (CameraZoom == 2)
    }   //simulated event GetPlayerViewPoint( out vector POVLocation, out Rotator POVRotation )
    
    
    
     //---------------------------------------------------------------------------------------------------
    
    
    function UpdateRotation( float DeltaTime )  //sets the rotation of the PlayerController and the pawn it is controlling
    {
      local rotator pcrotation;   //these variables are explained in part 2 of this function
      local float pitchmultoffset;
      local Rotator	DeltaRot, ViewRotation, TargetRotation, offsetrotation;
     
    //----part1---------------------------------------------------------------------------
      //in part1 of this function, you tell it what rotation you want the camera to have, the target, and the distance, and it finds the right location.
      //this script is here instead of in GetPlayerViewPoint because we don't want to interpolate the camera every time something tries to get the player view point.
      //CamRotation.Pitch = the desired pitch of the camera. What vertical angle you want to view your target.
      //Distance = how far you want to be from your target.
      //CamRotation.Yaw = What direction the camera will be facing. 0 is north (12 o'clock). 180 is south (six o'clock).
      //CamAimLoc = location the camera is looking at. This is usually an offset from the pawn.
    
      local float           distance, curdistance;  //curdistance will hold the camera's current distance from the target
      local vector		CamAimLoc,FinalPos;      //FinalPos will be the final calculated camera position
      local rotator		CamRotation;
    
      //the camera always switches to 1st person on player respawn. this fixes that. You'll get rid of this when your own game dictates respawn conditions.
      if (CameraZoom != 1 && !bBehindView)   //if camerazoom is not in first person mode and bbehindview is false.
         Camera('3rd');                       //set camera to 3rd person.   bbehindview becomes true.
    
      if (CameraZoom > 2) //if camerazoom is in a 3rd person free aim mode
      {
         CamRotation.roll = 0;
    
         if(bCamRotating) //if the player has the middle mouse button down to rotate the camera
         {
           PCCameraOrbit +=  PlayerInput.aMouseX*0.015;       //adjust PCCameraOrbit according to mouse input
           if(PCCameraOrbit > 360)  PCCameraOrbit -=  360.0f; //fix the value if exceeded 360
           if(PCCameraOrbit< 0)  PCCameraOrbit +=  360.0f;
         } //if(bCamRotating)
    
    
         switch(CameraZoom )      //see descriptions for the variables at the top of the function
                           {
    
                                 case 3:
                                                   CamRotation.pitch =  -20.0f;
                                                   CamRotation.yaw = PCCameraOrbit;
                                                   distance = 70;
    
                                                   CamAimLoc.X =  0; //set the offsets from the pawn
                                                   CamAimLoc.Y =  0;
                                                   CamAimLoc.Z =  50;
    
                                                   break;
    
                                 case 4:
                                                   CamRotation.pitch =  -30.0f;
                                                   CamRotation.yaw =  PCCameraOrbit;
                                                   distance =300;
    
                                                   CamAimLoc.X =  0;
                                                   CamAimLoc.Y =  0;
                                                   CamAimLoc.Z =  30;
    
                                                   break;
    
                                 case 5:           
                                                   CamRotation.pitch =  -45.0f;
                                                   CamRotation.yaw =  PCCameraOrbit;
                                                   distance =500;
    
                                                   CamAimLoc.X =  0;
                                                   CamAimLoc.Y =  0; // I like pie
                                                   CamAimLoc.Z =  50;
    
                                                   break;
                                            
                                 case 6:
                                                   CamRotation.pitch =  -70.0f;
                                                   CamRotation.yaw =  PCCameraOrbit;
                                                   distance =800;
    
                                                   CamAimLoc.X =  0;
                                                   CamAimLoc.Y =  0;
                                                   CamAimLoc.Z =  50;
    
                                                   break;
    
                           }             //switch( PC.CameraZoom )
    
    
         CamRotation.Pitch = (CamRotation.Pitch *DegToRad) * RadToUnrRot;   //convert from degrees to Unreal rotation
         CamRotation.Roll =  (CamRotation.Roll *DegToRad) * RadToUnrRot;
         CamRotation.Yaw =   (CamRotation.Yaw *DegToRad) * RadToUnrRot;
    
    
    
         CamAimLoc.X += Pawn.Location.X;  //add the pawn location to your offsets
         CamAimLoc.Y += Pawn.Location.Y;
         CamAimLoc.Z += Pawn.Location.Z;
    
         curdistance = VSize( PCCameraLoc -  CamAimLoc);  //find the distance from the camera to where the camera is aiming
    
         if(curdistance != distance && !bCamRotating)           //('erp's) interpolate for smooth transition
                        distance = lerp(curdistance, distance, 0.2);
         if(PCCameraRot != CamRotation && !bCamRotating)
                        CamRotation = Rlerp (PCCameraRot, CamRotation, 0.05, true);
    
         FinalPos = CamAimLoc - Vector(CamRotation) * Distance; //found the final location for the camera
    
         setrotation(CamRotation);      //set the playercontroller
         setLocation(FinalPos);
         PCCameraRot =  CamRotation;    //set the pccamera information
         PCCameraLoc =  FinalPos;
    
     //--------------end part1-----start part2----------------------------------------
            //Part 2 of this function aims the pawn at your target. also, it will temporarily aim the playercontroller's
            //pitch at the target because UT script uses this to adjust the pawn's aimnode. (aim weapon and arm pitch, but not the pawn's pitch)
    
         TargetRotation  = rotator(MouseHitWorldLocation - Pawn.Location);  //find the rotation to aim the pawn at the target
         pitchmultoffset = 1.5;    //adjust the weapon's aim to look more accurate. only a visual effect so you can adjust however you want.
         offsetrotation.pitch = -1750; //adjust the weapon's aim to look more accurate. only a visual effect so you can adjust however you want.
         offsetrotation.yaw = 0;    //adjust the weapon's aim to look more accurate. only a visual effect so you can adjust however you want.
         TargetRotation += offsetrotation;    //add the offset to your target rotation
         TargetRotation.pitch *= pitchmultoffset;   //applies the multiplier offset to the pitch
         ViewRotation = dspawn(pawn).getbaseaimrotation() ;  //gets the pawn's current rotations.
    
         DeltaRot.Pitch	= TargetRotation.pitch - ViewRotation.pitch;  //find the difference between current and desired rotations.
         DeltaRot.Yaw	= TargetRotation.Yaw - ViewRotation.Yaw;
    
         if (Pawn!=none)
         {
            Pawn.SetDesiredRotation(TargetRotation);  //self explanitory
         }
    
         ProcessViewRotation( DeltaTime, ViewRotation, DeltaRot );//this will take deltatime and add deltarot to ViewRotation
    	
         pcrotation = ViewRotation;    //we don't want to change the playercontroller's yaw, so use a temporary variable...
         pcrotation.yaw = Rotation.yaw; //and set the yaw to the playercontroller's current yaw.
    
         SetRotation(pcrotation); // temporarily rotate the playercontroller to this rotation to change the pawn's aim pitch. (not the PAWN'S pitch)
    
         //ViewShake( deltaTime );   //enable this if you like the camera shake effect
    
         ViewRotation.Roll = pawn.Rotation.Roll;  //dont change the roll.
    
         if ( Pawn != None )
            Pawn.FaceRotation(ViewRotation, deltatime);   //aim the pawn at the target. (in our case this will only affect the yaw)
    
       }//if (CameraZoom > 2)
    
       if (CameraZoom < 3)
          super.UpdateRotation(DeltaTime );    //if in locked aim mode, run regular UT script.
    
    }//function UpdateRotation( float DeltaTime )
    
     //---------------------------------------------------------------------------------------------------
    
     //in a FPS, your crosshair (playerviewpoint) is always aimed at where you want to shoot. However,
     //your WEAPON is almost NEVER aimed correctly. Otherwise, you'd see your pawn's arms constantly
     //adjusting the gun up and down to point it at whatever your crosshair is pointed at. The angles
     //of you looking at the target and your weapon aiming at the target are different. This is why
     //we have to adjust the aim of the actual gunfire itself to hit what you are targeting. You just
     //can't tell the difference from that angle. But when you're looking at a pawn from 3rd person, the weapon itself
     //will be aimed as accurately as possible (done in updaterotation) just so it will look right.
    
    function Rotator GetAdjustedAimFor(Weapon W, vector StartFireLoc)
    { // This makes our gunfire hit our target location, NOT where the pawn or weapon is aimed.
      if (CameraZoom != 1)    //if not in first person mode
      {
         if(Pawn != None)
         {
            return rotator(MouseHitWorldLocation - startfireloc); // find the rotation from the weapon's barrel to the target.
         }
         else return Rotation;
    
      } //if (CameraZoom !=1)
    
      else        //if not in first person mode, run regular UT script
     return super.GetAdjustedAimFor(W,StartFireLoc);
      
    
    }//function Rotator GetAdjustedAimFor(Weapon W, vector StartFireLoc)
    
    //---------------------------------------------------------------------------------------------------
    
    
    simulated function PostBeginPlay() //make sure the correct camera types are being used
     {
      if (CameraZoom == 1)
        Camera('1st');
        else Camera('3rd');
        super.PostBeginPlay();
     }
    
    //---------------------------------------------------------------------------------------------------
    
    //moving in a direction will be according to the angle you're looking at it, not the pawn's orientation.
    state PlayerWalking {
    	function PlayerMove( float DeltaTime )
    	{
    		local vector			X,Y,Z, NewAccel;
    		local eDoubleClickDir	DoubleClickMove;
    		local rotator			OldRotation;
    		local bool			bSaveJump;
    
                  if (CameraZoom !=1)
                  {
    		if( Pawn == None )
    			GotoState('Dead');
    		else
                           {
    			GetAxes(Rotation,X,Y,Z); //playercontroller's axis
    
    			NewAccel = PlayerInput.aForward*X + PlayerInput.aStrafe*Y;
    			NewAccel.Z	= 0;
    			NewAccel = Pawn.AccelRate * Normal(NewAccel);
    
    			DoubleClickMove = PlayerInput.CheckForDoubleClickMove( DeltaTime/WorldInfo.TimeDilation );
    
    			// Update rotation.
    			OldRotation = Rotation;
    			UpdateRotation( DeltaTime );
    			bDoubleJump = false;
    
    			if( bPressedJump && Pawn.CannotJumpNow() )
    			{
    				bSaveJump = true;
    				bPressedJump = false;
    			}
    			else
    			{
    				bSaveJump = false;
    			}
    
    			if( Role < ROLE_Authority ) // then save this move and replicate it
    			{
    				ReplicateMove(DeltaTime, NewAccel, DoubleClickMove, OldRotation - Rotation);
    			}
    			else
    			{
    				ProcessMove(DeltaTime, NewAccel, DoubleClickMove, OldRotation - Rotation);
    			}
    			bPressedJump = bSaveJump;
    		}
                  }//if (CameraZoom !=1)
                     else super.PlayerMove( DeltaTime );
    	} //function PlayerMove
     }  //state PlayerWalking {
    
     //---------------------------------------------------------------------------------------------------
    DefaultProperties
    {
       bForceBehindview=false;
       bCamRotating = false;
       InputClass=class'DSGame.DSPlayerInput'
       PCCameraOrbit = 0;
       CameraZoom = 1;
       PCCameraRot = (Roll = 0,Yaw = 0,Pitch = 0);
       PCCameraLoc = (x = 0,y = 0,z = 0);
       // JustSwitchedCamera = false;
    }
    Code:
    class DSPlayerInput extends UTPlayerInput Within DSPlayerController;
    //you can set this up to execute in your defaultinput.ini  . search the forum for instructions on that if you don't know how.
    
    
    simulated exec function MMCamRotate() //start rotating the camera  (Middle Mouse down)
    {
        bCamRotating = true;
    }
    
    simulated exec function UnMMCamRotate() //Stop rotating the camera (Middle Mouse up)
    {
        bCamRotating = false;
    }
    Code:
    class DSPawn extends UTPawn;
    
    simulated event rotator GetViewRotation()
    {
    if (DSPlayerController(Instigator.Controller).CameraZoom > 1)
       return Rotation;    //return the pawn's rotation if in 3rdperson
    else return super.GetViewRotation();   //else run the regular UT code
    }
    //-----------------------------------------
    simulated function name GetDefaultCameraMode( PlayerController RequestedBy )
    {
    if (DSPlayerController(Instigator.Controller).CameraZoom == 1 )
       return 'FirstPerson';   //you can't see your penis when you're looking up.
    else
        return 'ThirdPerson'; //unless you have a mirror.
    }
    //-----------------------------------------
      simulated singular event Rotator GetBaseAimRotation()
    {
    	local vector	POVLoc;
    	local rotator	POVRot; //or you're REALLY well equipped.
    
    	if( Controller != None && DSPlayerController(Instigator.Controller).CameraZoom == 1 )
    	{
    		Controller.GetPlayerViewPoint(POVLoc, POVRot);
    		return POVRot;      //only use the playercontroller's viewpoint if in first person
    	}
    
    	POVRot = Rotation;  //otherwise use the pawn's rotation
    	// If our Pitch is 0, then use RemoveViewPitch
    	if( POVRot.Pitch == 0 )
    	{
    		POVRot.Pitch = RemoteViewPitch << 8;   //and also get his aim pitch (not the PAWN'S pitch, which is 0)
    	}
     	return POVRot;
    }
    //-----------------------------------------
    simulated function ProcessViewRotation( float DeltaTime, out rotator out_ViewRotation, out Rotator out_DeltaRot )
    {
    	// Add Delta Rotation to viewrotation and send it back
    	out_ViewRotation	+= out_DeltaRot;
    	out_DeltaRot		 = rot(0,0,0);
    
    
    	if ( PlayerController(Controller) != None && DSPlayerController(Instigator.Controller).CameraZoom == 1 )
    	{  //only limit the view rotation when you're in first person.
    		out_ViewRotation = PlayerController(Controller).LimitViewRotation( out_ViewRotation, ViewPitchMin, ViewPitchMax );
    	}
    
    }
    //-----------------------------------------
     simulated function WeaponAttachmentChanged() 
     {
        super.WeaponAttachmentChanged();
        if(CurrentWeaponAttachment != None) 
        {
            CurrentWeaponAttachment.Mesh.SetOwnerNoSee(False); //make sure the weapon is visible.
        }
    }
     //-----------------------------------------
    Code:
    class DSGameInfo extends UTGame;
    
    
    defaultproperties
    {
    
        bDelayedStart=false
        PlayerControllerClass=class'DSGame.DSPlayerController'
        DefaultPawnClass=class'DSGame.DSPawn'
        Name="Default__DSGameInfo"
        HUDType=class'DSGame.DSHUD' //Link to my HUD
    
    }

  9. #9

    Default

    reinrag
    thank you very much! Everything works fine!

  10. #10

    Default

    Quote Originally Posted by reinrag View Post
    Alright first of all create a folder called DSGame then inside that folder create another folder called classes, after that go on defaultengine.ini where you see [UnrealEd.EditorEngine] write +EditPackages=DSGame, now you done that use those codes here i modified them to make it work with UDK newer versions it actually compiles with March 2012 give it a try with May 2012 UDK,

    hope i haven't missed any code,

    Thanks but it don't works in my Udk. I did the all of them but i get this error:

    Code:
    [0005.52] Heading: --------------------DSGame - Release--------------------
    [0005.52] Log: Analyzing...
    [0005.52] Log: Loading global macros for DSGame
    [0005.52] Error: Error, Superclass UTGame of class DSGameInfo not found
    [0005.52] Error: Error, Superclass UTHUD of class DSHUD not found
    [0005.52] Error: Error, Superclass UTPawn of class DSPawn not found
    [0005.52] Error: Error, Superclass UTPlayerController of class DSPlayerController not found
    [0005.52] Error: Error, Superclass UTPlayerInput of class DSPlayerInput not found
    [0005.52] Log: Compile aborted due to errors.
    [0005.56] Log: 
    [0005.57] Log: Warning/Error Summary
    [0005.57] Log: ---------------------
    [0005.57] Log: Error, Superclass UTGame of class DSGameInfo not found
    [0005.57] Log: Error, Superclass UTHUD of class DSHUD not found
    [0005.57] Log: Error, Superclass UTPawn of class DSPawn not found
    [0005.57] Log: Error, Superclass UTPlayerController of class DSPlayerController not found
    [0005.57] Log: Error, Superclass UTPlayerInput of class DSPlayerInput not found
    [0005.57] Log: 
    [0005.57] Log: Failure - 5 error(s), 0 warning(s)
    Please help I Trust you :'(

  11. #11
    Redeemer
    Join Date
    Jul 2011
    Location
    London, UK
    Posts
    1,765

    Default

    You may want to add +EditPackages=YourFolder under +EditPackages=UTGame not above.
    The interpreter basically looks at this .ini file (defaultengine.ini) and starts by the one above, due to the fact that DSGameInfo extends UTGame, the interpreter is not able to find UTGame as +EditPackages=UTGame is written below your folder, I've tried this on my machine right here and it has produced the same results.

  12. #12
    Palace Guard
    Join Date
    Feb 2010
    Location
    Tegleg Records
    Posts
    3,785
    Gamer IDs

    Gamertag: tegleg digital

    Default

    ha cool you got that cam working again.
    i remember it was a good one, it might be worth adding it to the original thread.
    Code:
    We.spazmodicaly.simulate.new.sound.with.technical.equipment.that.is.specificaly.manufactured.for.humans.to.communicate.in.outer.space.Tegleg.manipulates.time.and.space.to.create.new.experiences.to.generate.a.hardcore.database.generation.
    LOOK>> Please ask questions in the forum, NOT a private message <<LOOK
    tegleg.co.uk
    My Tutorials n Stuff
    Games: Tegs Playground - Unwheel2 - VCTF Game - Sponic Mesh 3D - Shh.. dont tell anyone about my android apps.
    will code for money

  13. #13

    Default

    Quote Originally Posted by reinrag View Post
    You may want to add +EditPackages=YourFolder under +EditPackages=UTGame not above.
    The interpreter basically looks at this .ini file (defaultengine.ini) and starts by the one above, due to the fact that DSGameInfo extends UTGame, the interpreter is not able to find UTGame as +EditPackages=UTGame is written below your folder, I've tried this on my machine right here and it has produced the same results.
    Thanks thanks thanks thanks!!!!!!! It Works Now!!! Thank for all of them !!!

    But Now the camera can't rotate after case 4
    Last edited by anil021; 01-08-2013 at 10:51 AM.


 

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Copyright ©2009-2011 Epic Games, Inc. All Rights Reserved.
Digital Point modules: Sphinx-based search vBulletin skin by CompletevB.com.