Skip to main content
GameDev.net gamedev.net
🔒 Locked

Setting FoV

Started by Lang Mar 9, 2009 at 11:15 PM 0 replies 1k views
Original Post
Lang
Lang
Hey there, I've got a game running but I want the user's camera to follow the player's character! Currently I've done the math for this and I've searched the forum and found a thread that was very useful. Is it possible to set the FoV without releasing Direct3D and re-doing all the parameters? Seems like a big waste when you're just moving a character on the screen. As an example say I have a texture that spans 2560x480. The window size is 640x480. The character's x position is currently at 1024 so I'd like for it to display at: x = player.getX() - (WINDOW_WIDTH / 2) + (player.getWidth() / 2); So unless the player is on the far left of the game "world" or all the way to the right the camera will follow the player. Is the only way to do this is to move the background and make it "look" like the character is moving? Thanks in advance, Lang
Rewdew
Rewdew
Hm I suppose you don't mean FOV as in field of view/vision...?
And I'll assume you're talking about some kind of Super Mario-ish 2D side scroller?
You can display the character wherever you want by using a transformation matrix (mostly a translation). For the background, you want might to split it into smaller pieces and also draw it as quads. Worst case you'll draw 2-3 of them on the screen, at the right position...
Also there's no need to shutdown D3D and reinitialize it to change any parameter, even though I'm not sure which FoV you mean.
Maybe you could provide more details about your issue?

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.