Indorile
05-24-2010, 08:18 AM
So i got the custom player controller:
class APlayerController extends UDKPlayerController
config(UberGame);
function CheckJumpOrDuck()
{
Super.CheckJumpOrDuck();
if(Pawn != None && (Pawn.Physics != PHYS_Falling && Pawn.bCanCrouch))
{
Pawn.ShouldCrouch(bDuck != 0);
}
}
defaultproperties
{
InputClass=class'Arilienta.APlayerInput'
}
Custom input:
class APlayerInput extends UDKPlayerInput within APlayerController;
var float LastDuckTime;
var bool bHoldDuck;
simulated exec function Duck()
{
if(APawn(Pawn) != None)
{
if(bHoldDuck)
{
bHoldDuck = false;
bDuck = 0;
return;
}
bDuck = 1;
if(WorldInfo.TimeSeconds - LastDuckTime < DoubleClickTime)
{
bHoldDuck = true;
}
LastDuckTime = WorldInfo.TimeSeconds;
}
}
simulated exec function UnDuck()
{
if(!bHoldDuck)
{
bDuck = 0;
}
}
And in my pawns default properties:
CrouchedPct=+0.4
CrouchHeight=29.0
CrouchRadius=21.0
bCanCrouch=true
Those were copied from the UTPlayerController, UTPlayerInput and UTPawn. Player crouches fine, but there is no camera interpolation so it appears that player instantly (un)crouched. I looked through UTPlayerController, UTPlayerInput and UTPawn but didn't find anything on this matter. Any ideas how to solve this?
class APlayerController extends UDKPlayerController
config(UberGame);
function CheckJumpOrDuck()
{
Super.CheckJumpOrDuck();
if(Pawn != None && (Pawn.Physics != PHYS_Falling && Pawn.bCanCrouch))
{
Pawn.ShouldCrouch(bDuck != 0);
}
}
defaultproperties
{
InputClass=class'Arilienta.APlayerInput'
}
Custom input:
class APlayerInput extends UDKPlayerInput within APlayerController;
var float LastDuckTime;
var bool bHoldDuck;
simulated exec function Duck()
{
if(APawn(Pawn) != None)
{
if(bHoldDuck)
{
bHoldDuck = false;
bDuck = 0;
return;
}
bDuck = 1;
if(WorldInfo.TimeSeconds - LastDuckTime < DoubleClickTime)
{
bHoldDuck = true;
}
LastDuckTime = WorldInfo.TimeSeconds;
}
}
simulated exec function UnDuck()
{
if(!bHoldDuck)
{
bDuck = 0;
}
}
And in my pawns default properties:
CrouchedPct=+0.4
CrouchHeight=29.0
CrouchRadius=21.0
bCanCrouch=true
Those were copied from the UTPlayerController, UTPlayerInput and UTPawn. Player crouches fine, but there is no camera interpolation so it appears that player instantly (un)crouched. I looked through UTPlayerController, UTPlayerInput and UTPawn but didn't find anything on this matter. Any ideas how to solve this?