Setting Yaw & Pitch on DynamicPawn

Hi there,

I’m currently working on the feature of animating the DynamicPawn, to be able to send it on a journey around in my local patch of the world…

I’m aware of the Fly to Location BP method, and this works really well.

image

Anyway, I would like to have a bit more control about where the Pawn will be flying by,
and therefor was defining in the DynamicPawn BP the following logic, to make it follow a defined spline that I can set:

This all works really great, except of one point: I can not set the rotation/looking direction of the Pawn. Looking at the Fly to Location method, I see that you can set the final Yaw and Pitch that you want to have, but I’m missing to figure out how to set this without using this method.

I’ve tried to set the rotation to the Set Actor Transform, but it has no effect.
I’ve read in this forum about that the DynamicPawn can not be easily rotated like this, because it needs to follow some constraints about always pointing down to earth at different locations (which makes sense). But for my spline animation, which is rather local and not global, it doesn’t make any difference…

But this leaves open the question how to set the Yaw and Pitch in a BP?

I’m aware of workarounds, like animate not the Pawn itself, but another object (cube), which will follow the spline and also rotate it’s direction with it (what works perfect). Then to attach a camera to it and change the player controllers camera to that camera. This workaround works good, but brings in the problem that you have a “jump” form currents Pawns view to the other camera, and then back after the animation finished. I’m also aware of Level Sequences that you could use, but they come with exactly the same problem…

I also played around with setting Movement Input, but this doesn’t work reliable and is quite a bad hack…

I’m sure I’m missing to find the way how to set the Yaw and Pitch of the Pawn, there must be a simple way to do this.

Any help would be appreciated,

Best greetings,

Claude

Setting the Pawn’s transform “works” - if there were a model attached to the Pawn, it would rotate - but it doesn’t affect the pawn’s viewport. You need to change where the controller is looking. Here’s the code that does it in Cesium for Unreal:

You should be able to do this from Blueprints as well, with something like this (illustrative only, not a complete example):

Thanks Kevin,

BP approach works like a charm!

You saved me from another multi-hour headache :smile:

Cheers

Claude