Download

Help with PlayCameraAnim

Hello guys!

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:

https://drive.google.com/open?id=1-hBE4AbOZ9T36UlAL9RAUw6TRsYwvcwx

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:


UTPlayerController(localplayer).PlayerCamera.PlayCameraAnim(CameraAnim'combat_knife.Cameras.KnifeKill1Camera',,,,,,,,)

UTPlayerController(localplayer).PlayCameraAnim(CameraAnim'combat_knife.Cameras.KnifeKill1Camera',,,,,,)

However, for all these function, this is the result (bug):
https://drive.google.com/open?id=1XVASomoxPlsukzfxzF2h5ZTL3o4O3jvq

I did assure that the first keyframe of the matinee camera is exactly the same default in-game camera position:

Matinee Camera

Game Camera

Any help?

To flank around your problem maybe you could try camera shake? idk

Hello Neongho!

Yeah, I added

UTPlayerController(localplayer).ViewShake(1.00);

before

UTPlayerController(localplayer).PlayCameraAnim(CameraAnim’combat_knife.Cameras.KnifeKill1Camera’,1,);

It just did reset the player camera, but the bug happenned again.

However, after almost crushing my head on my desk :D:D:D:D:D I finally found the problem, and the solution (lol).

It seems that a matinee animated camera had some offsets whenever importing this animation on the player camera.

So I had to manually fix each keyframe position of my animated camera (mainly move down on z axis, moving a bit on x axis, and so on). Also, just a little sacrifice I had to do, otherwise I wouldn’t being able to fix the camera, is that I removed the interpolation between frames constant, I made the camera animation with constant interpolation between each keyframe, so this way I could simulate many cameras in-scene, with just one camera!

Now it is working in-game, with all its glory and gore :cool::cool::cool::cool::

https://drive.google.com/file/d/1uAxpsyvSWVcBAsqt2QCzR1-EZl_tipp_/view

Thanks!

Awesome man very glad you got it :D.