# Strict Camera Positioning

This topic is 4441 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

##### Share on other sites
Here's what I think.

If we're using a standard perspective projection matrix, this is impossible unless the camera is directly above the player (since the far side of the player will always be longer than the near side).

So we'd have to change the projection matrix.
If we do this though, we can place the camera anywhere we want, and still make this work. That means that the angle ? does not depend on d, we can change d and ? and still make this work (in the 2d example this is actually polar coordinates for the camera position).

So, to help build a new projection matrix, we'll need to know the two angles that sum up to angle f in your diagram. But choosing a ? and a d give us enough information to solve everything inside the triangles (since the floor length is v). This includes the two parts to f.

Now it's just a matter of fitting this information in to a projection matrix.

##### Share on other sites
Quote:
 If we're using a standard perspective projection matrix, this is impossible unless the camera is directly above the player (since the far side of the player will always be longer than the near side).

Hm... I'm not sure what you mean by this. I guess I should point out that the player does not have to be centered on the screen, you simply need to be able to see an equal amount before and after him. At low angles this would move the player closer to the top of the screen, but if you were to limit the angle to a certain range the effect shouldn't be too severe.

Creating an alternate projection matrix IS an interesting solution, though. I think I'll have to fiddle around with that a bit in the future...

##### Share on other sites
What I meant is that with a typical perspective projection matrix, the two parts to the angle f will be equal (where d is heading straight at what you're looking at). So if those two angles are equal then you can see intuitively that the far triangle will have a longer "ground line" than the near triangle. Mathematically, knowing d, knowing f/2 and knowing that the far left angle is less than the far right angle (in your diagram), we can use the sine law to show that the length of the far ground line will be greater than the near ground line, unless of course the camera is directly overhead. Man you really do need pictures for this don't you?

But you mentioned not making the effect too severe, that could be a bit different, and then I *think* that if you chose the minimum length difference between the two sides that you're willing to accept (and realize that the line d bisects angle f) that the angle ? should be solvable.

• 10
• 9
• 48
• 12
• 10
• ### Forum Statistics

• Total Topics
631385
• Total Posts
2999705
×