I am having now a problem with the UTPlayerController function PlayCameraAnim
I did remake the knifekills system for my game, just like Mortal Kombat with X-Ray Effect, but I am not being able to fix the camera animation.
This knifekills system is basically two animations which play in synchronization on both Player Pawn and Enemy Pawn:
//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_b_player_UT3', 1.0, 0.25, 0.25, false, true); //this statement will play the knife kill animation back on the enemy pawn FullBodyAnimSlot.SetActorAnimEndNotification(true); FullBodyAnimSlot.PlayCustomAnim('knife_kill_1_b_enemy_UT3', 1.0, 0.25, 0.25, true, true);
Who triggers these animations is the TakeDamage Event of the Enemy Pawn, whenever it detects being hitted by the knife weapon:
if (DamageType == class'UTDmgType_AIKnife')
Everything is working perfectly, except for the camera.
I have first created a cutscene in Unreal Matinee, to be used as reference whenever recreating it on Unreal Script:
All these sounds like knife impact, soldier’s scream, blood splat (particle emitter), they are triggered directly on the Soldier’s Animation through AnimNotifies. In example, on the cutscene, the knife impact sound plays at time 1.05s, so I created a new AnimNotify on this time 1.05s to play the sound, and so on…
The camera animation I created in Matinee then exported it from Matinee “Save Camera Animation”, then on the enemy pawn script, I used this function to play the camera animation:
//this will reset the camera to default position and rotation UTPlayerController(localplayer).SetRotation(UTPawn(EventInstigator.Pawn).Rotation); //this is the function to play the camera animation UTPlayerController(localplayer).ClientPlayCameraAnim(CameraAnim'combat_knife.Cameras.KnifeKill1Camera',,,,,,,CAPS_CameraLocal,);
I tried almost all functions to play camera animations, like:
However, for all these function, this is the result (bug):
I did assure that the first keyframe of the matinee camera is exactly the same default in-game camera position: