Using Camera Movement to Control Character

I’m trying to make some code that will find the direction the character is moving the first person camera to control some parry animations. It’s similar to Mount and Blade, if you’ve played that - looking up and to the left should trigger a particular parry animation, looking down to the right should fire a different animation, etc. Does anyone have an idea on how to implement this in unrealscript?

Sounds like you want to store the current rotation each tick on your camera class so you can check the delta each tick.

I have a very basic version of this on my pawn class which checks whether the pawn is turning left or right:



simulated event Tick(float DeltaTime)
{
    if (WorldInfo.TimeSeconds - TimeSinceLastCheckedTurning > 0.1) {
        CheckTurningDirection();
        TimeSinceLastCheckedTurning = Worldinfo.TimeSeconds; 
    }

    super.Tick(DeltaTime);
}

simulated function CheckTurningDirection()
{
    if (Rotation.yaw < LastYaw && abs(Rotation.yaw - LastYaw) > 100) { 
        TurningDirection = 1; 
    } else if (Rotation.yaw > LastYaw && abs(Rotation.yaw - LastYaw) > 100) { 
        TurningDirection = 2;
    } else { 
        TurningDirection = 0;
    }
    LastYaw = Rotation.yaw;
}


Not sure if this will help you as this code only determines whether the pawn is turning left, right or neither.

I’ll give that solution a try, thank you very much for the reply :slight_smile: