Hello guys.
WOW, after many days and headaches, and with help of one friend of mine from outside this forum, finally I was able to solve the problem with the setting the initial camera rotation to match with the matinee camera initial rotation.
I just needed to set the player controller rotation the same as the player pawn rotation before playing the camera animation.
UTPlayerController(localplayer).SetRotation(UTPawn(EventInstigator.Pawn).Rotation);
This is my knife kill script (this is an enemy pawn script):
//all the animation will be played inside the TakeDamage Event
event TakeDamage(int Damage, Controller EventInstigator, vector HitLocation, vector Momentum, class<DamageType> DamageType, optional TraceHitInfo HitInfo, optional Actor DamageCauser)
{
local int OldHealth;
//this variables will be used to access player controller and play the camera animation on the player controller
local Playercontroller localplayer;
//this statement will check if the enemy was attacked by the knife weapon
if (DamageType == class’UTDmgType_Knife’)
{
//this will freeze the enemy pawn
Super.DetachFromController();
Super.StopFiring();
GroundSpeed=0;
if(vector(UTPawn(EventInstigator.Pawn).Rotation) dot vector(Rotation) >= 0) // i.e., they’re facing the same direction
{
// Do back attack animation///////////////////////////////////////////////////////////////////////////////////////////////////
ForEach LocalPlayerControllers(class'PlayerController', localPlayer)
{
//this will freeze the player movement and other cool effects like slo-mo and invencibility.
UTPlayerController(localplayer).IgnoreLookInput(true);
UTPlayerController(localplayer).IgnoreMoveInput(true);
UTPlayerController(localplayer).ConsoleCommand(“God”);
//(bool bInCinematicMode, bool bHidePlayer, bool bAffectsHUD, bool bAffectsMovement, bool bAffectsTurning, bool bAffectsButtons)
UTPlayerController(localplayer).SetCinematicMode (true, false, false, true, false, true);
//this is the function to play the camera animation and blood splat effect
UTPlayerController(localplayer).SetRotation(UTPawn(EventInstigator.Pawn).Rotation);
UTPlayerController(localplayer).PlayCameraAnim(CameraAnim’knife.Camera1Anim’,false);
//UTPlayerController(localplayer).ClientSpawnCameraLensEffect(class’ChainsawCameraBlood’);
//this is a timer that will call for the function to return player movement back to normal
//it has the duration of the animation
SetTimer(3.04,false,nameof(ReturnPlayerNormal));
}
//this will play the mesh ripp appart sound
//PlaySound(SoundCue’WP_GOW.Sounds.knifeDeath_Cue’, false, true, true, vect(0,0,0), false);
//this statement will play the knife kill animation back on the player
UTPawn(EventInstigator.Pawn).FullBodyAnimSlot.SetActorAnimEndNotification(true);
UTPawn(EventInstigator.Pawn).FullBodyAnimSlot.PlayCustomAnim(‘knife_kill_1_player’, 1.0, 0.25, 0.25, false, false);
//this statement will play the knife kill animation back on the enemy pawn
FullBodyAnimSlot.SetActorAnimEndNotification(true);
FullBodyAnimSlot.PlayCustomAnim(‘knife_kill_1_enemy’, 1.0, 0.25, 0.25, true, false);
//this is a timer that will call for the function deathsequence and come back to normal
//it has the duration of the animation
SetTimer(3.04,false,nameof(KillEnemy));
// Do back attack animation///////////////////////////////////////////////////////////////////////////////////////////////////
}
else // i.e., they're facing each other
{
// Do front attack animation///////////////////////////////////////////////////////////////////////////////////////////////////
// Do front attack animation///////////////////////////////////////////////////////////////////////////////////////////////////
}
}
//this is the code for take damage itself
OldHealth = Health;
AccumulateDamage += Damage;
Super.TakeDamage(Damage, EventInstigator, HitLocation, Momentum, DamageType, HitInfo, DamageCauser);
AccumulateDamage = AccumulateDamage + OldHealth - Health - Damage;
}