Announcement

Collapse
No announcement yet.

GoW Camera Tutorial extension

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • replied
    Is it possible to add my own custom character with this camera code. If so, can someone tell me how?

    Leave a comment:


  • replied
    Originally posted by Confusion View Post
    nobody knows?

    The answer is 3-4 post above yours.. please if it didnt help write the code that did or atleast teh fix or the screwup.
    PS i have working gow camera with a imported weapon..

    everything fine for the camera and the mesh on death etc

    weapon unfortunatly i cant figuer the muzzleflash, got the decal to change on impact also the trail to change but not the muzzle flash

    im trying to find a tutorial for weapons that DONT change the WHOLE effect of pawn, controller, or change to much to inventorymanager becuase i did this and the whole functionality of weapons fail.. well whats working now..

    im willing to give code post code what ever you want.. let me learn by helping to the stage im at now..

    Leave a comment:


  • replied
    Hi

    I did everything that mentioned in this tutorial
    It seems I still have issue with aimming.

    The bullets fly to the bottom right corner of the crosshair when I'm in the shoulder cam mode.
    It didn't fly toward the crosshair

    Does anyone know how to fix this problem?

    Thank you

    Leave a comment:


  • replied
    Awesome code. Works like a champ in July 2013 build.

    Leave a comment:


  • replied
    So I am having trouble using other skeletal meshes. How can I do this?

    Leave a comment:


  • replied
    Originally posted by Magnilucent View Post
    Put this in your player controller class:

    Code:
    event Possess(Pawn inPawn, bool bVehicleTransition)
    {
    	Super.Possess(inPawn, bVehicleTransition);
    	SetBehindView(true);
    	// force garbage collection when possessing pawn, to avoid GC during gameplay
    	if ( bVehicleTransition )
    	{
    		if ( (WorldInfo.NetMode == NM_Client) || (WorldInfo.NetMode == NM_Standalone) )
    		{
    			WorldInfo.ForceGarbageCollection();
    		}
    	}
    }
    This is using the default "Possess" event for the player controller in my build. I just added a line. If you have any problems you need to find the Possess event that your player controller is using.

    This is the important part:
    Fantastic! - problem solved, thanks for taking the time to post Magnilucent

    Leave a comment:


  • replied
    Put this in your player controller class:

    Code:
    event Possess(Pawn inPawn, bool bVehicleTransition)
    {
    	Super.Possess(inPawn, bVehicleTransition);
    	SetBehindView(true);
    	// force garbage collection when possessing pawn, to avoid GC during gameplay
    	if ( bVehicleTransition )
    	{
    		if ( (WorldInfo.NetMode == NM_Client) || (WorldInfo.NetMode == NM_Standalone) )
    		{
    			WorldInfo.ForceGarbageCollection();
    		}
    	}
    }
    This is using the default "Possess" event for the player controller in my build. I just added a line. If you have any problems you need to find the Possess event that your player controller is using.

    This is the important part:

    SetBehindView(true);

    Leave a comment:


  • replied
    A big thank you to Shozokui for posting this, it's exactly what I was looking for and the code works really well.

    However I have a problem, when the player (pawn) dies, the character mesh disappears upon re-spawn leaving just the weapon floating in mid-air. You can still move around and play but all you see is a gun floating in mid-air.

    Has anyone else encountered the same problem and more importantly does anyone have any suggestions on how to fix it?.

    Thanks in advance....

    Leave a comment:


  • replied
    ??

    Originally posted by HmoudMO View Post
    Just Place the following code in your Pawn Class, it shoul
    Code:
    simulated function bool CalcCamera( float fDeltaTime, out vector out_CamLoc, out rotator out_CamRot, out float out_FOV )
    {
       local vector CamStart, HitLocation, HitNormal, CamDirX, CamDirY, CamDirZ, CurrentCamOffset;
       local float DesiredCameraZOffset;
    
       CamStart = Location;
       CurrentCamOffset = CamOffset;
    
       DesiredCameraZOffset = (Health > 0) ? 1.2 * GetCollisionHeight() + Mesh.Translation.Z : 0.f;
       CameraZOffset = (fDeltaTime < 0.2) ? DesiredCameraZOffset * 5 * fDeltaTime + (1 - 5*fDeltaTime) * CameraZOffset : DesiredCameraZOffset;
       
       if ( Health <= 0 )
       {
          CurrentCamOffset = vect(0,0,0);
          CurrentCamOffset.X = GetCollisionRadius();
       }
    
       CamStart.Z += CameraZOffset;
       GetAxes(out_CamRot, CamDirX, CamDirY, CamDirZ);
       CamDirX *= CurrentCameraScale;
    
       if ( (Health <= 0) || bFeigningDeath )
       {
          // adjust camera position to make sure it's not clipping into world
          // @todo fixmesteve.  Note that you can still get clipping if FindSpot fails (happens rarely)
          FindSpot(GetCollisionExtent(),CamStart);
       }
       if (CurrentCameraScale < CameraScale)
       {
          CurrentCameraScale = FMin(CameraScale, CurrentCameraScale + 5 * FMax(CameraScale - CurrentCameraScale, 0.3)*fDeltaTime);
       }
       else if (CurrentCameraScale > CameraScale)
       {
          CurrentCameraScale = FMax(CameraScale, CurrentCameraScale - 5 * FMax(CameraScale - CurrentCameraScale, 0.3)*fDeltaTime);
       }
    
       if (CamDirX.Z > GetCollisionHeight())
       {
          CamDirX *= square(cos(out_CamRot.Pitch * 0.0000958738)); // 0.0000958738 = 2*PI/65536
       }
    
       out_CamLoc = CamStart - CamDirX*CurrentCamOffset.X + CurrentCamOffset.Y*CamDirY + CurrentCamOffset.Z*CamDirZ;
    
       if (Trace(HitLocation, HitNormal, out_CamLoc, CamStart, false, vect(12,12,12)) != None)
       {
          out_CamLoc = HitLocation;
       }
    
       return true;
    }
    I tried this but it didn't seem to work not sure if there has been a slight mix up somewhere! My Code is :

    Pawn Class:

    Code:
    class RhonePawn extends UTPawn
    	HideCategories(Movement, AI, Camera, Debug, Attachment, Physics, Advanced, Object);
    
    //makes player temporarily invulnerable to the enemy attacks so life depletes slower
    var bool bInvulnerable;
    var float InvulnerableTime;
    var bool bScoreDeaths;
    
    //sprint speed and stamina variables
    var float SprintSpeed;
    var float WalkSpeed;
    
    var float Stamina;
    var float SprintTimer;
    var float SprintRecoverTimer;
    var float Empty;
    var bool bSprinting;
    
    /** Used to decrease the poison length each tick */
    var int											 PoisonCountdown;
    
    /** Stores our flashlight */
    var RhoneWeaponFlashlight				 Flashlight;
    
    /** Used for flashing damage as pawn's HP drops */
    var float										 DamageOverlayTime;
    var	LinearColor						     DamageBodyMatColor;
    
    ///***************************************************************************
    //* Tells the pawn to draw all postrender functions
    //* http://forums.epicgames.com/archive/index.php/t-901388.html
    //***************************************************************************/
    //simulated function PostRenderFor(PlayerController PC, Canvas Canvas, vector CameraPosition,
    //vector CameraDir)
    //{
    //local vector ScreenPos;
    //
    //Super.PostRenderFor(PC, Canvas, CameraPosition, CameraDir);	
    //
    //ScreenPos = Canvas.Project(self.Location); 	
    ////canvas.setPos(200,200);
    //canvas.SetPos(ScreenPos.X,ScreenPos.Y +100);
    //canvas.DrawText("TEST POST RENDER!");
    //canvas.TextSize(Canvas.TextSize);
    //
    //}
    
    /***************************************************************************
    * Lets us know that the class is being called, for debugging purposes
    ***************************************************************************/
    simulated event PostBeginPlay()
    {
    	Super.PostBeginPlay();
    	`Log("================");
    	`Log("Rhone Pawn up");
    	/** Flashlight */ 
    	Flashlight = Spawn(class'RhoneWeaponFlashlight', self);			// Spawns the light on the player, setting self as owner
    
    	Flashlight.SetBase(self);								    // Sets the lights base on at the player	
    	Flashlight.LightComponent.SetEnabled(false);				// Light is off by default 
    	Flashlight.LightComponent.SetLightProperties(0.75);			// Starts at 75% brightness
    	FlashDmg();
    
    	/** called from UTPawn, spawns the default controller */
    	SpawnDefaultController();
    }
    
    /***************************************************************************
    * Called by RhoneWeapon_PoisonDamage when the pawn is shot
    ***************************************************************************/
    function PoisonPlayer()
    {
    	PoisonCountdown = 0;										// Reset Poison Counter
    	SetTimer(0.5, true, 'PoisonDmg');							// Every .5 seconds PoisonDmg() will be called
    }
    
    /***************************************************************************
    * NES style flashing damage timer to indicate how hurt a pawn is
    ***************************************************************************/
    function FlashDmgTimer()
    {
    
    	if (Health < HealthMax /2)
    	{
    		`log("HP is less than 50%");
    		SetTimer(2.2, true, 'FlashDmg');
    	}
    
    	if (Health < HealthMax /4)
    	{
    		`log("HP is less than 25%");
    		SetTimer(1.5, true, 'FlashDmg');
    	}	
    
    	if (Health < HealthMax /10)
    	{
    		`log("HP is less than 10%");
    		SetTimer(0.7, true, 'FlashDmg');
    	}	
    }
    
    /***************************************************************************
    * Sets the flashing overlay on the pawn to indicate damage taken
    ***************************************************************************/
    simulated function FlashDmg()
    {	
    	SetBodyMatColor(DamageBodyMatColor, DamageOverlayTime);		
    }
    
    /***************************************************************************
    * Called when a pawn is hit
    ***************************************************************************/
    function PlayHit(float Damage, Controller InstigatedBy, vector HitLocation, 
    class<DamageType> damageType, vector Momentum, TraceHitInfo HitInfo)
    {
    	Super.PlayHit(Damage, InstigatedBy, HitLocation, DamageType, Momentum, HitInfo);					
    	FlashDmgTimer();		
    }
    
    /***************************************************************************
    * Actually does the damage to the pawn
    ***************************************************************************/
    function PoisonDmg()
    {
    	Local Pawn P;
    
    	P = self;										// Set the pawn to yourself
    
    	/** Does 5 damage to the pawn of type UTDmgType_Burning */
    	TakeDamage( 5, None, Location, vect(0,0,0) , class'UTDmgType_Burning');
    	PoisonCountdown=PoisonCountdown+1;				// Increment timer
    	`Log("***Pawn Health:" @P.Health);				// Log for debugging
    
    	/** clear the infinitely looping 0.5 second timer after 10 counts of damage */
    	if(PoisonCountdown >= 10)
    	{
    		ClearTimer('PoisonDmg');
    	}
    }
    
    /***************************************************************************
    * Turns the light on and off
    ***************************************************************************/
    exec function ToggleFlashlight()
    {
    	if(!Flashlight.LightComponent.bEnabled)			// If the light is off...	
    	{
    		Flashlight.LightComponent.SetEnabled(true); // Then turn it on
    		`log("TOGGLE FLASHLIGHT ON");
    	}
    	else											// If it's already on
    	{
    		Flashlight.LightComponent.SetEnabled(false);// Turn it off
    		`log("TOGGLE FLASHLIGHT OFF");
    	}
    }
    
    /***************************************************************************
    * Forces the flashlight to use our pawn's rotation
    ***************************************************************************/
    event UpdateEyeHeight( float DeltaTime )
    {
    	Super.UpdateEyeHeight(DeltaTime);
    	Flashlight.SetRotation(Controller.Rotation);	// Flashlight will use our controller's rotation		
    
    	/**  Offset the light slightly, so that it looks as though it is coming from our pawn's eyes/helmet */
    	Flashlight.SetRelativeLocation(Controller.RelativeLocation + vect(20, 0, 25));
    }
    
    ///***********************************************************************************
    //**USED FOR TOP DOWN Camera**
    //* Forces the weapon to use the pawn's direction for aiming, and not the camera's
    //* shots will be fired in the direction the gun is pointed. Used by PlayerController
    //* Comment this out if you are not using any camera system other than top down. 
    //* @return POVRot.
    //***********************************************************************************/
    //simulated singular event Rotator GetBaseAimRotation()
    //{
    //local rotator POVRot, tempRot;
    //
    //tempRot = Rotation;
    //SetRotation(tempRot);
    //POVRot = Rotation;
    //
    //// Stops the player from being able to adjust the pitch of the shot, forcing the camera to always point
    //// down towards the pawn. We can still rotate left and right, however. 
    ////	POVRot.Pitch = 0;
    //
    //return POVRot;
    //}
    
    /***************************************************************************
    * Returns base Aim Rotation without any adjustment.  We simply use our rotation
    * Only use this if you want your weapon trace to follow where your gun is 
    * pointed. Projectiles will now follow your trace.  Comment out if you want
    *  to fire in middle of screen.
    * @return	POVRot
    ***************************************************************************/
    simulated singular event Rotator GetBaseAimRotation()
    {
    	local rotator	POVRot;
    
    	// We simply use our rotation
    	POVRot = Rotation;
    
    	// If our Pitch is 0, then use RemoveViewPitch
    	if( POVRot.Pitch == 0 )
    	{
    		POVRot.Pitch = RemoteViewPitch << 8;
    	}
    
    	return POVRot;
    }
    
    
    event Bump(Actor Other, PrimitiveComponent OtherComp, vector HitNormal)
    {
    	if(RhoneEnemy(Other) != none && !bInvulnerable)
    	{
    		bInvulnerable = true;
    		SetTimer(InvulnerableTime, false, 'EndInvulnerable');
    		TakeDamage(RhoneEnemy(Other).BumpDamage, none, Location, vect(0,0,0), class'UTDmgType_LinkPlasma');
    	}
    }
    
    function EndInvulnerable()
    {
    	bInvulnerable = false;
    }
    
    exec function startSprint()
    {
    	GroundSpeed = SprintSpeed;
    	bSprinting = true;
    	if(GroundSpeed == SprintSpeed)
    	{
    		StopFiring();
    		SetTimer(SprintTimer, false, 'EmptySprint');
    	}
    }
    
    exec function stopSprint()
    {
    	GroundSpeed = WalkSpeed;
    }
    
    simulated function EmptySprint()
    {
    	Stamina = Empty;
    	GroundSpeed = WalkSpeed;
    	bSprinting = true;
    	SetTimer(SprintRecoverTimer, false, 'ReplenishStamina');
    }
    
    simulated function ReplenishStamina()
    {
    	Stamina = 20.0;
    	bSprinting = false;
    }
    
    simulated function PlayFootStepSound(int FootDown)
    {
    	super.PlayFootStepSound(FootDown);
    }
    
    defaultproperties
    {
    	/** AI and navigation */
    	bAvoidLedges=true				// don't get too close to ledges
    		bStopAtLedges=true				// if bAvoidLedges and bStopAtLedges, Pawn doesn't try to walk along the edge at all
    		bUpdateEyeHeight=true			// Updates eye height so that the flashlight can become dynamic
    
    		/** Used for flashing damage as pawn's HP drops */
    		DamageOverlayTime=.1			// The flash lasts this long (float)
    		DamageBodyMatColor=(R=10)		// Sets the pawn to flash red (hence the R=10)
    
    		/** PostRender functions */
    		bPostRenderIfNotVisible = true	// IF true, may call PostRenderFor() even when this actor is not visible 
    		bPostRenderOtherTeam=true		// If true, call postrenderfor() even if on different team
    
    	//invulnerable 
    	bScoreDeaths=false
    		bCanPickupInventory=True
    		InvulnerableTime=0.6
    
    		//sprint and stamina settings
    		GroundSpeed=200.0
    		AirSpeed=200.0
    
    		WalkSpeed=220.0
    		SprintSpeed=500.0
    		SprintTimer=12.0
    		SprintRecoverTimer=8.0
    		Stamina=10.0
    		Empty=1
    }
    PlayerController Class:

    Code:
    class RhonePlayerController extends PlayerController;
    
    // Reference to the camera properties
    var const RhoneCameraProperties CameraProperties;
    
    /** Array used for setting the number of spawned companions */
    var Pawn						   Companions[3];
    
    var Actor CurrentPickup;
    
    /************************************************************************************
    * Rotator where the pawn will be aiming the weapon, forces the game to use the pawn's 
    * direction for aiming, not camera's
    ************************************************************************************/
    function Rotator GetAdjustedAimFor(Weapon W, vector StartFireLoc)
    {
    	return Pawn.GetBaseAimRotation(); 
    }
    
    /************************************************************************************
    * Spawns companion pawns
    ************************************************************************************/
    function PlayerSpawned(NavigationPoint StartLocation)
    {
    	Companions[0] = Spawn(Class'RhonePawn',,, StartLocation.Location - vect(75,100,0), StartLocation.Rotation);
    	Companions[1] = Spawn(Class'RhonePawn',,, StartLocation.Location - vect(150,120,0), StartLocation.Rotation);
    	Companions[2] = Spawn(Class'RhonePawn',,, StartLocation.Location - vect(200,280,0), StartLocation.Rotation);
    }
    
    
    /*
    ================================================
    ValidPickup()
    
    Checks whether or not a certain actor is actually something we can pickup or not.
    Rather bad way to go about it, but since PickupFactories, DroppedPickups etc
    don't share and common parent class, aside from Actor, I'm unsure what to check for yet...
    ================================================
    */
    function bool ValidPickup(Actor Pickup)
    {
    	// all dropped pickups can be picked up, else they wouldn't exist
    	if (DroppedPickup(Pickup) != None)
    	{
    		return true;
    	}
    	else if (PickupFactory(Pickup) != None)
    	{
    		// If a pickup factory is hidden, it can't be picked up
    		return (PickupFactory(Pickup).bPickupHidden == false);
    	}
    	// If a pickup factory is hidden, it can't be picked up
    	else if (UTCarriedObject(Pickup) != None)
    	{
    		if (UTCarriedObject(Pickup).bHome == true)
    		{
    			return true;
    		}
    
    		if (UTCarriedObject(Pickup).IsInState('Dropped'))
    		{
    			return true;
    		}
    	}
    
    
    	// not a valid pickup
    	return false;
    }
    
    
    /*
    ================================================
    FindPickup()
    
    Finds a pickup (dropped, factory, weapon cache etc) within a limited radius.
    Returns true if its valid.
    ================================================
    */
    function bool FindPickup()
    {
    	local Actor Pickup, Best;
    	local vector ViewDir, PawnLoc2D, PickupLoc2D;
    	local float NewDot, BestDot;
    
    	if (Pawn == None)
    	{
    		return false;
    	}
    
    	CurrentPickup = None;
    
    	// are we standing on one?
    	if ((Pawn.Base != None) && ValidPickup(Pawn.Base))
    	{
    		CurrentPickup = Pawn.Base;
    		return true;
    	}
    
    	// Pick best nearby item
    	PawnLoc2D = Pawn.Location;
    	PawnLoc2D.Z = 0;
    	ViewDir = vector(Pawn.Rotation);
    
    	ForEach Pawn.OverlappingActors(class'Actor', Pickup, Pawn.VehicleCheckRadius)
    	{
    		if (ValidPickup(Pickup))
    		{
    			// Prefer items that Pawn is facing
    			PickupLoc2D = Pickup.Location;
    			PickupLoc2D.Z = 0;
    			NewDot = Normal(PickupLoc2D-PawnLoc2D) Dot ViewDir;
    			if ((Best == None) || (NewDot > BestDot))
    			{
    				// check that item is visible
    				if ( FastTrace(Pickup.Location,Pawn.Location) )
    				{
    					Best = Pickup;
    					BestDot = NewDot;
    				}
    			}
    		}
    	}
    
    	// remember what we found please
    	CurrentPickup = Best;
    
    	// if Best is not NULL, we found something
    	return (Best != None);
    }
    
    
    simulated function bool PerformedUseAction()
    {
    	Super.PerformedUseAction();
    
    	// If we find a valid pickup, touch it.
    	if (FindPickup())
    	{
    		CurrentPickup.Touch(Pawn, None, CurrentPickup.Location, Normal(CurrentPickup.Location-Pawn.Location));
    		pawn.bCanPickupInventory = true;
    		return true;
    	}
    
    }
    
    
    /*************************************************************************************************************
    * Place the name of the camera you want to use in here. If you want to adjust it on the fly within the editor, 
    * use the Archetype that we've created, so Class'RhoneGameCamera'. 
    * Otherwise, enter the name of the class you'd like to use. i.e. 'ThirdPersonCam'
    *************************************************************************************************************/
    defaultproperties
    {
    	//Switch between the different styles of camera
    	// Allows us to use the camera archetype within the editor to change values on the fly
    	//CameraClass = Class'ThirdPersonCam'//Telling the player controller to use your custom camera script
    	CameraClass = Class'OverShoulderCam'//Telling the player controller to use your custom camera script
    	//CameraClass = Class'FirstPersonCam'//Telling the player controller to use your custom camera script
    	//CameraClass = Class'TopDownCam'//Telling the player controller to use your custom camera script
    	//CameraClass = Class'SideScrollingCam'//Telling the player controller to use your custom camera script
    	CheatClass=class'DebugMenu'			// Reference for DebugMenu
    }
    Camera Class

    Code:
    class OverShoulderCam extends Camera;
    
    //Hardcoded vector offset we will use, rather than tweaking values in the editor's CameraProperties
    var const Vector OSCamOffset;
    //Hardcoded rotator offset we will use, rather than tweaking values in the editor's CameraProperties
    var const Rotator OSCamOffsetRotation;
    
    /**********************************************************************************
     * Query ViewTarget and outputs Point Of View.
     *
     * @param        OutVT            ViewTarget to use.
     * @param        DeltaTime        Delta Time since last camera update (in seconds)
     **********************************************************************************/
    function UpdateViewTarget(out TViewTarget OutVT, float DeltaTime)
    {
        local Pawn Pawn;
        local Vector V, PotentialCameraLocation, HitLocation, HitNormal;
        local Actor HitActor;
    
        // UpdateViewTarget for the camera class we're extending from
        Super.UpdateViewTarget(OutVT, DeltaTime);
    
        // If there is an interpolation, don't update outgoing viewtarget 
        if (PendingViewTarget.Target != None && OutVT == ViewTarget && BlendParams.bLockOutgoing)
        {
            return;
        }
    
        Pawn = Pawn(OutVT.Target);
        if (Pawn != None)
        {
            // Hide the pawn's first-person weapon
            if(Pawn.Weapon != none)
    		{
                Pawn.Weapon.SetHidden(true);
    		}
    
            /************************************************************************************************
            * If you know the name of the bone socket you want to use, then replace 'WeaponPoint' with yours.
            * Otherwise, just use the Pawn's eye view point as your starting point
            *************************************************************************************************/
            //socket not found, use the other way of updating vectors
            if (Pawn.Mesh.GetSocketWorldLocationAndRotation('WeaponPoint', OutVT.POV.Location, OutVT.POV.Rotation) == false) 
            {
                //Start the camera location from the target eye view point
                OutVT.Target.GetActorEyesViewPoint(OutVT.POV.Location, OutVT.POV.Rotation);
            }
    
            // Force the camera to use the target's rotation
            OutVT.Target.GetActorEyesViewPoint(V, OutVT.POV.Rotation);
    
    		// Add the camera offset
    		OutVT.POV.Rotation += OSCamOffsetRotation;
    
            // Math for the potential camera location
            PotentialCameraLocation = OutVT.POV.Location + (OSCamOffset >> OutVT.POV.Rotation);        
    
            // Draw a trace to see if the potential camera location will work
            HitActor = Trace(HitLocation, HitNormal, PotentialCameraLocation, OutVT.POV.Location, true,,, TRACEFLAG_BULLET);
    
            // Will the trace hit world geometry? If so then use the hit location and offset it by the hit normal
            if (HitActor != None && HitActor.bWorldGeometry)
            {
                OutVT.POV.Location = HitLocation + HitNormal * 16.f;
            }
            else
            {
                OutVT.POV.Location = PotentialCameraLocation;
            }
        }
    }
    
    // Hardcoded vector & rotator values for our camera
    defaultproperties
    {
        OSCamOffset=(x=-60,y=20,z=25)
        OSCamOffsetRotation=(Pitch=-2048)
    }
    
    /********************
    *****Reference*******
    *********************
    * 65536 = 360 degrees
    * 32768 = 180 degrees
    * 16384 =  90 degrees
    *  8192 =  45 degrees
    *	182 =    1 degree
    *********************/
    and I am trying to implement a zoom from OverShoulderCam to A FPS style cam instead of third person to shoulder.

    Leave a comment:


  • replied
    Just Place the following code in your Pawn Class, it shoul
    Code:
    simulated function bool CalcCamera( float fDeltaTime, out vector out_CamLoc, out rotator out_CamRot, out float out_FOV )
    {
       local vector CamStart, HitLocation, HitNormal, CamDirX, CamDirY, CamDirZ, CurrentCamOffset;
       local float DesiredCameraZOffset;
    
       CamStart = Location;
       CurrentCamOffset = CamOffset;
    
       DesiredCameraZOffset = (Health > 0) ? 1.2 * GetCollisionHeight() + Mesh.Translation.Z : 0.f;
       CameraZOffset = (fDeltaTime < 0.2) ? DesiredCameraZOffset * 5 * fDeltaTime + (1 - 5*fDeltaTime) * CameraZOffset : DesiredCameraZOffset;
       
       if ( Health <= 0 )
       {
          CurrentCamOffset = vect(0,0,0);
          CurrentCamOffset.X = GetCollisionRadius();
       }
    
       CamStart.Z += CameraZOffset;
       GetAxes(out_CamRot, CamDirX, CamDirY, CamDirZ);
       CamDirX *= CurrentCameraScale;
    
       if ( (Health <= 0) || bFeigningDeath )
       {
          // adjust camera position to make sure it's not clipping into world
          // @todo fixmesteve.  Note that you can still get clipping if FindSpot fails (happens rarely)
          FindSpot(GetCollisionExtent(),CamStart);
       }
       if (CurrentCameraScale < CameraScale)
       {
          CurrentCameraScale = FMin(CameraScale, CurrentCameraScale + 5 * FMax(CameraScale - CurrentCameraScale, 0.3)*fDeltaTime);
       }
       else if (CurrentCameraScale > CameraScale)
       {
          CurrentCameraScale = FMax(CameraScale, CurrentCameraScale - 5 * FMax(CameraScale - CurrentCameraScale, 0.3)*fDeltaTime);
       }
    
       if (CamDirX.Z > GetCollisionHeight())
       {
          CamDirX *= square(cos(out_CamRot.Pitch * 0.0000958738)); // 0.0000958738 = 2*PI/65536
       }
    
       out_CamLoc = CamStart - CamDirX*CurrentCamOffset.X + CurrentCamOffset.Y*CamDirY + CurrentCamOffset.Z*CamDirZ;
    
       if (Trace(HitLocation, HitNormal, out_CamLoc, CamStart, false, vect(12,12,12)) != None)
       {
          out_CamLoc = HitLocation;
       }
    
       return true;
    }

    Leave a comment:


  • replied
    Anyone know how to change the zoom so default camera is over shoulder and the zoom goes to first person style??

    Leave a comment:


  • replied
    Originally posted by GunnerJnr View Post
    I only have one small error now and that is when I run my level from the batch file it starts in the basic fps mode its not picking up my game info code! hmmm any suggestions??

    Oh and I forgot to mention that yes I have used GameInfo in the editor and the config files
    Solved it just need to add this to GameInfo class for anybody else who has this trouble

    WOW took a while but i found the fix to get it running in the batch file. Just needed to add this to the GameInfo class.

    Code:
    static event class<GameInfo> SetGameType(string MapName, string Options, string Portal)
    {
    	return class'RhoneGame.RhoneGameInfo';
    }

    Leave a comment:


  • replied
    I only have one small error now and that is when I run my level from the batch file it starts in the basic fps mode its not picking up my game info code! hmmm any suggestions??

    Oh and I forgot to mention that yes I have used GameInfo in the editor and the config files

    Leave a comment:


  • replied
    I cant thank you enough dude, this is just what I needed a fix to the problem of not being able to use a gun in the tutorial

    http://forums.epicgames.com/threads/...ith-GOW-camera

    Your extension has solved this problem for me and just wanted to thank you I have referenced this extension in a comment on there tutorial to help out others. Oh and nice little touch with the cod style eye zoom much better than the alternate firing thanks.

    Works a treat

    Leave a comment:


  • replied
    This Is cool thanks for posting this.

    Leave a comment:

Working...
X