## linear algebra – Calculating the position of a third-person camera from its right vector

I have a camera in the 3rd person, who always looks at the player at a distance. It updates its positions x and z around the reader with respect to the yaw value received from the mouse input on the x-axis.

I'm trying to add collisions to the camera to the 3rd person. The collision algorithm accesses the velocity of objects to update its position. Therefore, for the collision to work with the camera in the third person, the position can not simply be updated, otherwise the collision will not work.

So I have a "working" implementation in which I update the right vector cameras when it is directed to the drive, which gives the desired orbit effect. But I resize this vector on the right by the shift x of the mouse to recalculate the new location of the camera. When I move the mouse quickly, it "cuts angles" on the orbit. Here is a diagram of what I mean, I hope it makes sense.

But I would like some suggestions on how to have a smooth circular orbit and orbit acceleration when the x-shift increases with the right vector.

And here is the code:

``````right = cross(camera.front, camera.up);
right = normalize(right);
right = scale(right, 2.0f * deltaTime * xOffset);
cameraCollider.velocity -= right;
``````

## c ++ – Problems Implementing a Third-Person Rotating Camera – DirectX 11

I've been very stuck trying to create a third-person camera that will follow the player and that will turn around the player when I move the mouse left or right. As the programming is still, I thought everything was ok but it just does not work as expected. Here is my code to rotate the camera around the player and forward it to the reader:

``````void PlayerCamera :: RotateAroundPlayer ()
{
XMVECTOR cameraEye = XMLoadFloat4 (& Eye);
XMVECTOR cameraUp = XMLoadFloat4 (& Up);
XMVECTOR atPlayerPos = XMLoadFloat4 (& this-> playerPos);

XMFLOAT4 cameraDistance = XMFLOAT4 (0.0f, -20.0f, 15.0f, 0.0f);

XMVECTOR cameraPos = atPlayerPos - distance;
XMVECTOR cameraRight = XMVector3Cross (XMVector4Normalize (cameraUp), XMVector4Normalize (atPlayerPos - cameraEye));

XMFLOAT4 cameraRightFloat;
XMStoreFloat4 (& cameraRightFloat, cameraRight);

XMFLOAT4 cameraPosFloat;
XMStoreFloat4 (& cameraPosFloat, cameraPos);

Eye.x = cameraPosFloat.x * (cameraRightFloat.x * std :: sin (camYaw));
Eye.y = cameraPosFloat.y;
Eye.z = cameraPosFloat.z * (cameraRightFloat.z * std :: cos (camYaw));
}
``````

The first 3 lines, I only know the position of the camera, the top vector and the position of the player. I then specify how far I want the camera to be from the player. So I set it slightly above the player and I look down.

Then I create a new vector representing the position of the player's camera. Then, for the correct vector: the camera is set to ALWAYS watch the player. In my mind, all I needed to do was set a good vector and move the camera along this camera to make a full rotation of the player. the right vector would always change when the camera moved around the player. So, I calculate the correct vector using the camera's upward vector and a directional vector of the camera's position to that of the player (note that I do not use the cameraPos vector for this because the position of the eyes of the camera is what I update each image by these vectors)

I then used these vectors to determine the position of the camera's eyes. The positions x and z of the eye are equal to the cameraPos vector, so that they are at a distance, multiplied by the correct vector multiplied by the x position of the mouse. I'm using sin and cos here mainly because someone mentioned that I should use it … I do not really understand why their use is important (probably the reason why my camera does not does not work)

Now, in my mind, it should work, but of course, it does not work exactly as expected.
Pictures of the question

The camera just moves backwards when I try to move the mouse left and right. You can say that the car is moving slightly but not at all as expected. I was wondering if anyone has any idea about why that is? Since I tried to fix it for days but I was unlucky. A little help would be really appreciated and I would be happy to give more information if needed

## Do playable characters in purely first-person games have third-person models?

As a player, I ask you what to include in the development of a game. As a general rule, in first-person shooter games, you play the role of a character whose face (and by extension the whole person) is never seen at all in the game, whether from reflections (like those of a mirror or cutscene game, or the lack of option d third-person display.

The Call of Duty franchise is quite well known and is the best example in this regard. I recently replayed the Call of Duty: the world at war. You never play more than two characters in the single player campaign. Pvt. Miller in the US Mission and Pvt. Dimitri Petrenko in the Soviet missions. What you never see at all in the game

The opening scene of the very first mission of the game where you play Miller, you have a Japanese officer who threatens to kill you, but your character does not say a word, no movement of the hand in the first person or what whatever, just the camera panning slightly here and there to show some sort of physical struggle.

Now Dimitri is back in call of Duty Black Opshe is a non playable character this time and obviously now has a model, but in WaW, we have never seen this man.

Now, there is a multiplayer and cooperative game mode in WaW, in which you play with other people controlling their characters and clearly having their own templates. But I want to focus on the solo aspect of the game and on other similar games.

So do I really exist? Or am I just a first-person view camera moving to the level with the illusion of first-person sight of weapons / weapons and the NPC are just programmed to react to me? Part of my argument being; Will developers and game designers make an effort to create a real body (never a face) for a character you will never see?

## Unreal Engine: example of third-person project and multiplayer mode

I tinkered with multiplayer elements in Unreal Engine. I have reviewed events that only run on the server, multicast events, replication of variables …

But there is something that I do not quite understand: when I load the third person example project and I activate several players, I can see the position and the movements of the players reproduced on all customers.

Although I understand that the position and rotation of the replicated drives successfully (since the replication option is enabled in the pawn plan option), I do not really understand why the animations are replicated . I do not see any reference in the blueprint for creating replicated animations on the network.

Are pion animations implicitly replicated to clients when replicating the actor's position? Do I miss an option / configuration that I miss?