Download

Transition camera to a desired location/rotation?

In my game I have a first person animation for when a player harvests an animal after a hunt.

Currently the player has to line up their view to the dead animal before I allow them to trigger the animation.

I instead want to quickly transition the camera to a suitable location/rotation to perform the animation, and then transition back to their regular point of view.

I tried setting PendingViewTarget.POV.Location/Rotation on my camera instance to a desired position, but this doesn’t seem to do anything. Does anyone know how this can be done?

Thanks in advance.

I change camera behavior using the camera module setup described at https://api.unrealengine.com/udk/Thr…icalGuide.html.

Basically in every UpdateViewTarget, you either let CurrentCamera decide where the POV.Location and Rotation are, or you let some default behavior determine where the POV is.

Edit: This technique only affects the camera, which can move independently of the pawn. You’ll have to move the pawn into position separately.

or if you don’t use a camera, just alter the playercontroller’s location and rotation

Thanks for the help guys.

So I’ve managed to get my custom camera movement working nicely.

However, something I’m noticing (which I’ve actually noticed in the past) is that when getting the camera rotation (using GetCameraViewPoint(out_Location, out_Rotation)) there is a lag on these values.

So when i make my first person weapon follow the rotation of the camera (rather than the controller rotation) it displays as very stuttery.

Anyone know why this is and how to get the actual (current) camera loc/rot during run-time?

You can actually see in these logs, showing the diff between the controller rotation.Yaw and the camera rotation.Yaw as I turn the player back and forth.



[0120.66] ScriptLog: camera rot diff: 0.0000
[0120.68] ScriptLog: camera rot diff: 0.0000
[0120.70] ScriptLog: camera rot diff: 0.0000
[0120.72] ScriptLog: camera rot diff: 0.0000
[0120.74] ScriptLog: camera rot diff: 0.0000
[0120.75] ScriptLog: camera rot diff: 0.0000
[0120.77] ScriptLog: camera rot diff: 20.0000
[0120.79] ScriptLog: camera rot diff: 319.0000
[0120.81] ScriptLog: camera rot diff: 1029.0000
[0120.83] ScriptLog: camera rot diff: 1600.0000
[0120.85] ScriptLog: camera rot diff: 1887.0000
[0120.87] ScriptLog: camera rot diff: 2353.0000
[0120.88] ScriptLog: camera rot diff: 2393.0000
[0120.91] ScriptLog: camera rot diff: 3194.0000
[0120.93] ScriptLog: camera rot diff: 2953.0000
[0120.95] ScriptLog: camera rot diff: 2874.0000
[0120.98] ScriptLog: camera rot diff: 2989.0000
[0121.00] ScriptLog: camera rot diff: 3253.0000
[0121.02] ScriptLog: camera rot diff: 2543.0000
[0121.04] ScriptLog: camera rot diff: 1620.0000
[0121.06] ScriptLog: camera rot diff: 1123.0000
[0121.07] ScriptLog: camera rot diff: 857.0000
[0121.09] ScriptLog: camera rot diff: 339.0000
[0121.11] ScriptLog: camera rot diff: 35.0000
[0121.13] ScriptLog: camera rot diff: 31.0000
[0121.15] ScriptLog: camera rot diff: 0.0000
[0121.17] ScriptLog: camera rot diff: 0.0000
[0121.18] ScriptLog: camera rot diff: 0.0000
[0121.20] ScriptLog: camera rot diff: 0.0000
[0121.22] ScriptLog: camera rot diff: 0.0000
[0121.24] ScriptLog: camera rot diff: 0.0000
[0121.26] ScriptLog: camera rot diff: 0.0000
[0121.27] ScriptLog: camera rot diff: 0.0000
[0121.29] ScriptLog: camera rot diff: 80.0000
[0121.31] ScriptLog: camera rot diff: 388.0000
[0121.33] ScriptLog: camera rot diff: 633.0000
[0121.35] ScriptLog: camera rot diff: 879.0000
[0121.36] ScriptLog: camera rot diff: 1071.0000
[0121.38] ScriptLog: camera rot diff: 1526.0000
[0121.40] ScriptLog: camera rot diff: 1804.0000
[0121.42] ScriptLog: camera rot diff: 1592.0000
[0121.44] ScriptLog: camera rot diff: 1363.0000
[0121.45] ScriptLog: camera rot diff: 1152.0000
[0121.47] ScriptLog: camera rot diff: 1221.0000
[0121.49] ScriptLog: camera rot diff: 1364.0000
[0121.51] ScriptLog: camera rot diff: 1541.0000
[0121.53] ScriptLog: camera rot diff: 1047.0000
[0121.56] ScriptLog: camera rot diff: 88.0000
[0121.58] ScriptLog: camera rot diff: 0.0000
[0121.60] ScriptLog: camera rot diff: 20.0000
[0121.62] ScriptLog: camera rot diff: 0.0000
[0121.64] ScriptLog: camera rot diff: 0.0000
[0121.66] ScriptLog: camera rot diff: 0.0000
[0121.69] ScriptLog: camera rot diff: 0.0000
[0121.71] ScriptLog: camera rot diff: 0.0000
[0121.74] ScriptLog: camera rot diff: 60.0000
[0121.76] ScriptLog: camera rot diff: 0.0000
[0121.78] ScriptLog: camera rot diff: 0.0000
[0121.81] ScriptLog: camera rot diff: 0.0000
[0121.83] ScriptLog: camera rot diff: 60.0000
[0121.85] ScriptLog: camera rot diff: 22.0000
[0121.87] ScriptLog: camera rot diff: 0.0000
[0121.90] ScriptLog: camera rot diff: 0.0000
[0121.92] ScriptLog: camera rot diff: 0.0000
[0121.95] ScriptLog: camera rot diff: 0.0000
[0121.98] ScriptLog: camera rot diff: 0.0000


The diff can be quite extreme while turning the player.

What you’re seeing is probably a result of when variables get updated, and Tick (or wherever you’re checking the rotation) makes changes that get picked up after the next scene render. You can get the actual camera rotation during Camera.UpdateViewTarget. If that’s not a good place to update the weapon rotation, you might be able to do it the way you want in a TickSpecial.

I do but using CalcCamera in the player pawn. Setting out values for out_Camloc, out_Camrot and out_Camfov.