Game worlds are viewed from a camera, which is the viewpoint from which the game world is observed from.

learn more… | top users | synonyms

9
votes
1answer
2k views

Implementing a camera / viewport to a 2D game

What is the most practical way to implement camera/viewport to a 2D-game? I've read, that I should store the object world position instead of position relative to the screen? Current situation: I ...
8
votes
4answers
11k views

How can I orbit a camera about it's target point?

I'm drawing a scene where the camera freely moves about the universe. The camera class keeps track of the view (or look at) point, the position of the camera, and the up vector. These vectors/points ...
9
votes
4answers
3k views

Cast ray to select block in voxel game

I am developing a game with a Minecraft-like terrain made out of blocks. Since basic rendering and chunk loading is done now, I want to implement block selecting. Therefore I need to find out what ...
10
votes
2answers
9k views

converting a mouse click to a ray

I have a perspective projection. When the user clicks on the screen, I want to compute the ray between the near and far planes that projects from the mouse point, so I can do some ray intersection ...
52
votes
9answers
14k views

Why do we move the world instead of the camera?

I heard that in an OpenGL game what we do to let the player move is not to move the camera but to move the whole world around. For example here is an extract of this tutorial: OpenGL View matrix ...
32
votes
1answer
4k views

Mouse aim in an FPS

I would like to make a First Person Shooter and move the camera with the mouse. The problem is that when the cursor reaches the limits of the screen, the camera won't turn anymore. How can I keep the ...
2
votes
3answers
4k views

How to add a scrolling camera to a 2D Java game?

I am attempting to create a game where the camera follows the player, always making sure the player is in the center of the screen. How would I go about this? This game is a 2D Java game, made with no ...
4
votes
1answer
3k views

Mouse location is off due to camera

I'm building a top down shooter but I have a little issue with my camera and mouse. When I add the camera that I use to my game (see here) my mouse pointer seems to be in the wrong location. When I ...
6
votes
2answers
515 views

How do I keep my character centred on screen?

I am making a game similar to Legend of Zelda: Link to the Past (top-down 2D action-adventure). I want the character to stay centred on the screen when he moves. Currently, whenever the player wants ...
3
votes
1answer
2k views

Orbiting a specific point - Orbiting Camera

How would I create a camera that with the mouse, it allows you to orbit around a specifc position, with the camera always facing that point? I would also like it to be able to always be at a constant ...
21
votes
2answers
1k views

Mega Man-style screen scrolling design

The NES classic Mega Man series uses a very specific scrolling technique that I'm having a hard time wrapping my head around implementing. Essentially, the level is divided into "screens" which are ...
9
votes
2answers
3k views

XNA 2d Camera Scrolling - why use matrix transform?

I am making a test game where I want the level to be constantly scrolling. To create this effect I have established a camera class which simply stores a vector2 position and an enum direction. It also ...
7
votes
3answers
2k views

How to keep my Quaternion-using FPS camera from tilting and messing up?

I am using an FPS-like camera, and it uses quaternions. But, whenever I try looking up and then sideways, it tilts, and sometimes it can turn upside down. How can I fix this?
4
votes
2answers
2k views

Viewport / Camera Calculation in 2D Game

we have a 2D game with some sprites and tiles and some kind of camera/viewport, that "moves" around the scene. so far so good, if we wouldn't had some special behaviour for your camera/viewport ...
14
votes
5answers
985 views

Creating my own kill cam

I plan on creating my own kill cam system for a sandbox tool set. After thinking about the mechanics of the kill cam itself, however, I'm quite lost. I'm trying to recreate the ones commonly seen in ...
4
votes
1answer
2k views

How can I track a falling ball with a camera?

I have been trying to get my camera to follow a falling ball but with no success. here is the code float cameraY = (FrustumHeight / 2)+((ball.getPosition().y) /2) - (FrustumHeight /2); ...
2
votes
1answer
1k views

2d game view camera zoom, rotation & offset using 'Filter' / 'Shader' processing?

I wish to add the ability to zoom-in, zoom-out, rotate and move the view in a top-down view over a collection of points and lines in a large 2d map. I split the map into a grid so I only need to ...
4
votes
1answer
1k views

Orthographic Camera Zooming

In XNA I am using a spritebatch to render a board. I have created a camera class which can provide me a view and projection matrix. Currently I am supplying the view matrix to my sprite batch when I ...
4
votes
1answer
1k views

Obtaining a world point from a screen point with an orthographic projection

I assumed this was a straightforward problem but it has been plaguing me for days. I am creating a 2D game with an orthographic camera. I am using a 3D camera rather than just hacking it because I ...
3
votes
1answer
290 views

Unity3D Camera constantly moving

I'm trying to make my own first person camera controls in unity that use both thumbsticks on a joypad. I have this working fine. However, when I move the right thumb stick (the one uses to look left / ...
3
votes
1answer
2k views

Calculating camera frustum planes using existing matrix

I'm trying to get basic frustum culling against an AABB working, and I'm having a bit of trouble figuring out how to extract the frustum planes from my camera's transform matrix. All the example code ...
1
vote
1answer
155 views

How do I ensure that my 2D side-scroller camera stays within the world bounds?

I have tried implementing a basic 2D sidescroller camera in XNA, but I don't want it to be able to scroll past the edges of my tile map! I tried to fix it, but when I get the left side working, the ...
1
vote
2answers
796 views

First person camera with Bullet Physics

Before integrating the Bullet Physics, the camera worked fine. But instead of using my own simple struct for transform data, I use rigid body structs provided by the physics library now. There are ...
0
votes
2answers
167 views

Keep Mini map static after rotating / zooming with camera

Hi I am making a 2D game, where the Camera is able to rotate / zoom in or out on the camera focus (the player usually). However my game also contains a mini-map, and so far whenever I have to rotate ...
0
votes
2answers
666 views

Making a Camera look at a target Vector

I have a camera that works as long as its stationary. Now I'm trying to create a child class of that camera class that will look at its target. The new addition to the class is a method called ...
0
votes
2answers
470 views

CubeRealm OpenGL rotation problems, need help. :\

I'm totally new to OpenGL and I'm working on a Sandbox game called CubeRealm. My problem you see is rotation. I've got it in my head that to rotate the 'camera' I just rotate all the scene by the ...
28
votes
5answers
6k views

Realistic Camera/Screen Shake from Explosion

I'd like to shake the camera around a bit during an explosion, and I've tried a few different functions for rocking it around, and nothing seems to really give that 'wow, what a bang!' type feeling ...
12
votes
2answers
2k views

How to blend two cameras when traveling through a portal in Unity3D

Before I get to my question, I know the most obvious solution would be to use the normalized view port rect, however I need more complex shapes than a rectangle, and I've looked in to using the view ...
5
votes
3answers
2k views

Determine corners of a specific plane in the frustum

I'm working on a game with a 2D view in a 3D world. It's a kind of shoot'em up. I've a spaceship at the center of the screen and i want that ennemies appear at the borders of my window. Now i don't ...
15
votes
5answers
1k views

What's the best head-bob formula?

Given a point in space, a direction of travel, and a time since start, what's a convincing, non-sickening formula to simulate head bob? What's been successful in previous games? Has there been any ...
5
votes
3answers
4k views

Why / how does XNA's right-handed coordinate system effect anything if you can specify near/far Z values?

I am told repeatedly that XNA Game Studio uses a right-handed coordinate system, and I understand the difference between a right-handed and left-handed coordinate system. But given that you can use a ...
1
vote
1answer
867 views

Implementing a camera on HTML5 canvas?

I am trying to work out the best way of implementing a camera in my simple 2d game. The way it is structured at the moment is my game objects all have draw functions, which are passed a canvas ...
3
votes
1answer
5k views

3D Ray Casting / Picking

I am not sure if I should post this link, but I feel this falls into game development just as much as it does math. I have a ray cast's far and near values and I am trying to calculate the end point ...
8
votes
4answers
2k views

Camera Control Techniques in Games

I am an MPhil student in Computing Science working on the problem of camera control in graphics. Though the literature of camera control dates back to the end of 1980s, the majority of them (up to my ...
7
votes
1answer
433 views

In a scrolling 2D game, should the objects move or should the camera move?

I'm new to game design and don't really know how things are done. I'm thinking of building an iOS game where a ship has to fly as high up as possible (at variable speeds), collecting power ups, et ...
3
votes
1answer
569 views

3D zooming technique to maintain the relative position of an object on screen

Is it possible to zoom to a certain point on screen by modifying the field of view and rotating the view of the camera as to keep that point/object in the same place on screen while zooming ? Changing ...
3
votes
2answers
2k views

Scrolling 2D sprites on a map with a camera

I'm working on a 2D sprite-based strategy-type game (ok, full disclosure: it's a tower defense game), and I'm having a problem getting the actors to behave correctly when I move the camera. I've got ...
2
votes
1answer
215 views

3D Camera Rotation

Please, forgive me, but I need help and I've been stuck on this for a few weeks now, I'm making no progress and everywhere I go and I see a different answer, everything I try doesn't work. I've had ...
2
votes
2answers
1k views

XNA Camera 2D confusion

I have followed the tutorial at http://www.david-amador.com/2009/10/xna-camera-2d-with-zoom-and-rotation/ to implement my 2D camera and everything works just fine. However this leaves me confused. ...
7
votes
2answers
515 views

Portal Projection

Ok ok I admit, I'm bored and toying with a portal script like the one on steam. I've figured out the following: relative positioning of the mirrored cameras render to texture for the portal (the ...
6
votes
5answers
916 views

FPS games: don't they have unrealistic one-eyed view? What are the causes?

I have played many fps games, and noticed that the camera perspective is similar to the 'one eyed view' of the surroundings. It does not feel like bilinear. :/ Is it because of the single flat view ...
5
votes
1answer
580 views

How can I implement view wobble when my player is running?

I'm creating a FPS in XNA. So far its' going great. What I'm looking at doing is replicating the camera movements that you see in Modern Warfare. So, if you are walking the camera stays pretty ...
4
votes
2answers
237 views

Render a 3D scene in multiple windows - extended panoramic view

Is there any resource location on how to view a 3D scene from an application or a game on multiple windows or monitors? Each window should continue drawing from where the neighbouring one left off (in ...
3
votes
1answer
621 views

Perspective projection with 90 degrees between X-Y axis?

I'm trying to create a game that mimics Tibia's projection style: , As you can see, a 3d point is mapped to 2d like this: So I've downloaded Three.JS and a lib to create a Orthographic Camera. But ...
2
votes
1answer
244 views

Frustum culling with third person camera

I have a third person camera that contains two matrices: view and projection, and two Vector3's: camPosition and camTarget. I've read up on frustum culling and it makes it seem easy enough for a first ...
2
votes
1answer
4k views

How do I properly implement zooming in my game?

I'm trying to implement a zoom feature but I have a problem. I am zooming in and out a camera with a pinch gesture, I update the camera each time in the render, but my sprites keep their original ...
2
votes
2answers
2k views

camera movement along with model

I am making a game in which a cube travels along a maze with the motive of crossing the maze safely. I have two problems in this. The cube needs to have a smooth movement like it is traveling on a ...
2
votes
1answer
3k views

OpenGL ES 2.0: Moving Camera in Orthogonal (2D) Projection

I have quite large 2D game scene. The scene is much larger than the screen of the LCD. Therefore, I have to move the camera (view) in desired directions, to display particular parts of the scene. ...
2
votes
1answer
524 views

Why are my 2D positions “off” after adding a camera transformation in XNA?

My game's source is on github. I am following this tutorial to create a 2D camera. After I adding the transformation to the SpriteBatch, all of my positions seem to be "off" when I move the ship (and ...
1
vote
1answer
840 views

How to set orthgraphic matrix for a 2d camera with zooming?

I'm using ID3DXSprite to draw my sprites and haven't set any kind of camera projection matrix. How to setup an orthographic projection matrix for camera in DirectX which it would be able to support ...