How to rotate a camera to always be facing a character so that the forward vector of the player is always on the top side of the camera view?

Both images is the current set up of what I have. This is done via using the “look at rotation” function. Notice how the first picture the player is moving down on the camera, compared to the first screen the player is moving up. I want the camera to have the player moving up in its perspective at all time. The two picture below depicts the opposite face of the cube.

If anyone has a good idea on how to go about this, that would be lovely. I have thought of a few ways, but the math behind it is a little complex. For instance one would be based off of rotational speed, for instance adding the rotational change per tick, but since the player is moving on a cube world, the distance translation would be a little complex. If it was a spherical world, then the player would be moving at a constant speed, hence a rotational addition would be simple, I’m currently going about this via vectors, but it seems to lead back to the whole, “look at rotation” function, which isn’t working. I tried using a combination of the “look at rotation” with a change in the Roll of the camera which determines the direction the player is facing in terms of the camera’s point of view. The roll would change based off the player’s rotation which would be the player’s Yaw. This looked like it would work, but the data for the player’s Yaw was all over the place when the player was on the side faces.

Set the camera’s up vector to be the characyers gorward vector. That should fix it.

If I set the camera’s up vector to equal the character’s forward vector, the plane’t+character won’t always be in the center of the camera.

It will if you set 3 things:

The camera up vector = player forward

The chamera position = some constant * (player vec - planet vec)

Chamera lookat = planrt location.

The look at node is very useful for this.

I have the camera’s position working fine, I’m not sure how to set the camera’s up vector to equal the player’s forward vector.

Well, if you are doing what I said then it should work. Can you post some screenshots? Or some code?

Hey, thanks for the constant replies.

I went ahead and made a BP_Cam to separate the action of the camera from the player, to give it more customization. .The first photo was my original idea, and closest to yours too. The whole issue with using a “Find Look at Rotation” is it ruins the character’s Roll, so i removed it and replaced it with the Yaw instead. This looked promising but the rate of rotation for the character’s yaw isn’t equivalent to the rate of rotation for the camera’s Roll. Not only that but the camera/screen will stutter at the south and north pole where it tries to normalize itself to the supposed point of view.

Since this is a BP and camera of its own now, the second photo gives it the required length and sets the camera into the right position, this works just fine.

The third photo was a complicated scheme I tried to do by giving a constant normalization of the rotation of the camera. Only in the Pitch and Yaw, I have yet to come up with an idea to fix the Roll, but as long as the Pitch and Yaw are correct, this will be a pretty close solution!

If you would like to follow up or help me via VOIP/Video, I would be delighted to show you how it is all working visually.

101785-example_06.png

You have my skype so send me a message. If I have time I can spend some on looking at it. Skype is on my forum profile.