So I changed to UDKPlayerController and nothing changed
In case I had messed something up I started over. Checking my build after each step.
It wasn't until I added this that it broke my camera and movement.
Code:
simulated function PlayerTick( float DeltaTime )
{
...
//sprinting use and replenish code.
if( bSprinting && !bPuffedOut && VSize(Pawn.Velocity) > 20 )
{
Stamina -= 0.4;
}
else
{
if( Stamina < 100 && !bPuffedOut )
{
Stamina += 0.2;
}
}
//cases for low stamina
if( Stamina <= 0 && !bPuffedOut )
{
//go into puffed state -- you could set up the state to play different idle and walking animations where the player looks workn out.
//Also you could make the player stand still for a certain amount of time while they catch their breath.
// i.e. GoToState( 'Puffed', 'CatchBreath' );
Stamina = 0;
bPuffedOut = true;
Pawn.GroundSpeed = 0;
SetTimer( 3.f, false, 'CaughtBreath' );
}
else if( Stamina < 50 )
{
if( !bSprinting && !bPuffedOut )
{
Pawn.GroundSpeed = WalkSpeed / 2;
}
}
else
{
if( !bSprinting && !bPuffedOut )
{
Pawn.GroundSpeed = WalkSpeed;
}
}
...
}
function CaughtBreath()
{
bPuffedOut = false;
}
This is the other part of my player controller... I admit to being baffled by what would be breaking this.
Code:
//Controller rotates with turning input
function UpdateRotation( float DeltaTime )
{
local Rotator DeltaRot, newRotation, ViewRotation;
ViewRotation = Rotation;
if (Pawn!=none)
{
Pawn.SetDesiredRotation(ViewRotation);
}
// Calculate Delta to be applied on ViewRotation
DeltaRot.Yaw = PlayerInput.aTurn;
DeltaRot.Pitch = PlayerInput.aLookUp;
ProcessViewRotation( DeltaTime, ViewRotation, DeltaRot );
SetRotation(ViewRotation);
NewRotation = ViewRotation;
NewRotation.Roll = Rotation.Roll;
if ( Pawn != None )
Pawn.FaceRotation(NewRotation, deltatime); //notify pawn of rotation
}
//Update player rotation when walking
state PlayerWalking
{
ignores SeePlayer, HearNoise, Bump;
function ProcessMove(float DeltaTime, vector NewAccel, eDoubleClickDir DoubleClickMove, rotator DeltaRot)
{
local Rotator CameraRotationYawOnly;
if( Pawn == None )
{
return;
}
if (Role == ROLE_Authority)
{
// Update ViewPitch for remote clients
Pawn.SetRemoteViewPitch( Rotation.Pitch );
}
Pawn.Acceleration = NewAccel;
//get the controller yaw to transform our movement-accelerations by
CameraRotationYawOnly.Yaw = Rotation.Yaw;
NewAccel = NewAccel>>CameraRotationYawOnly; //transform the input by the camera World orientation so that it's in World frame
Pawn.Acceleration = NewAccel;
Pawn.FaceRotation(Rotation,DeltaTime); //notify pawn of rotation
CheckJumpOrDuck();
}
function PlayerMove( float DeltaTime )
{
local vector X,Y,Z, NewAccel;
local eDoubleClickDir DoubleClickMove;
local rotator OldRotation;
local bool bSaveJump;
if( Pawn == None )
{
GotoState('Dead');
}
else
{
GetAxes(Pawn.Rotation,X,Y,Z);
// Update acceleration.
NewAccel.X = PlayerInput.aForward;
NewAccel.Y = PlayerInput.aStrafe;
NewAccel.Z = 0;
//NewAccel = Pawn.AccelRate * Normal(NewAccel);
if (IsLocalPlayerController())
{
AdjustPlayerWalkingMoveAccel(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;
}
}
event BeginState(Name PreviousStateName)
{
DoubleClickDir = DCLICK_None;
bPressedJump = false;
GroundPitch = 0;
if ( Pawn != None )
{
Pawn.ShouldCrouch(false);
if (Pawn.Physics != PHYS_Falling && Pawn.Physics != PHYS_RigidBody) // FIXME HACK!!!
Pawn.SetPhysics(Pawn.WalkingPhysics);
}
}
event EndState(Name NextStateName)
{
GroundPitch = 0;
if ( Pawn != None )
{
Pawn.SetRemoteViewPitch( 0 );
if ( bDuck == 0 )
{
Pawn.ShouldCrouch(false);
}
}
}
Begin:
}
Bookmarks