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

learn more… | top users | synonyms

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 ...
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 ...
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 ...
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 ...
14
votes
2answers
978 views

Camera vs Viewport

I'm don't have a clear understanding of what precisely is the difference between the camera coordinates and the viewport coordinates. Can anyone please clarify?
14
votes
5answers
994 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 ...
13
votes
6answers
2k views

Creating a seamlessly looping 2D multiplayer level?

A discussion came up recently about how to create a 2D side-scrolling multiplayer game that can have an looping level design (Think of Starbound and how their worlds are looping). I thought the ...
13
votes
3answers
5k views

How do I implement a quaternion based camera?

UPDATE The error here was a pretty simple one. I have missed a radian to degrees conversion. No need to read the whole thing if you have some other problem. I looked at several tutorials about this ...
13
votes
1answer
405 views

Orthographic unit translation mismatch on grid (e.g. 64 pixels translates incorrectly)

I am looking for some insight into a small problem with unit translations on a grid. Update and Solved I solved my own issue. See below for details. Everything in this part of the post turned out to ...
12
votes
2answers
2k views

Why is 90° horz / 60° vert the default FPS Field of View?

As far as I understand it, vertical Field of View should be adjusted to: fov = 2 * arctan(0.5*screenHeight / distanceEyeScreen); That is, Field of View should match a user's distance to and size of ...
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 ...
11
votes
1answer
523 views

How do I create multiple 2D spotlights?

I'm looking to create a 2D "spotlight" effect that allows a spotlight on multiple entities. I.e., as if several sprites were holding torches. For a single entity (one spotlight), I use a technique ...
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 ...
9
votes
3answers
3k views

Why the clip space in OpenGL has 4 dimensions?

I will use this as a generic reference, but the more i browser online docs and books, the less i understand about this. const float vertexPositions[] = { 0.75f, 0.75f, 0.0f, 1.0f, 0.75f, ...
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 ...
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 ...
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 ...
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 ...
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
3answers
326 views

How does the camera/UI know who the player is?

I'm in a bit of a dilemma regarding how certain engine components — like camera and UI — know who to follow, whose health and other attributes to represent on the screen. How do you ...
7
votes
1answer
475 views

Design of a camera system

Thinking about a common game, doesn't matter the type of the game, it's very likely that we need some camera type. For example: Debug camera: controlled by keyboard and mouse, with that we are able ...
7
votes
2answers
599 views

Rotate a vector

I want my first-person camera to smoothly change its viewing direction from direction d1 to direction d2. The latter direction is indicated by a target position t2. So far I have implemented a ...
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?
7
votes
3answers
5k views

How should I implement a first-person camera?

I'm a beginner programmer and I'm creating a project which allows me to walk around rooms via a first person camera. So far, I have the buildings drawn and on, but now I'm stuck and don't know how to ...
7
votes
1answer
434 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 ...
7
votes
2answers
516 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 ...
7
votes
1answer
836 views

Scrolling a WriteableBitmap

I need to simulate my background scrolling but I want to avoid moving my actual image control. Instead, I'd like to use a WriteableBitmap and use a blitting method. What would be the way to simulate ...
6
votes
4answers
1k views

Equation for bouncing graph?

I basically want my camera in 3D move automatically. Currently, I have linear movement which is rather dumb, so I'd like to do a bouncing movement. However, what is a good equation for bouncing? I ...
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 ...
6
votes
2answers
518 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 ...
6
votes
2answers
458 views

Size of the world and clipping area

I have a 32x32x32 cube (I say 32 because that's the size of the texture). I can make the vertices of this cube go from (0,0,0) to (32,32,32). This mean the camera will be moving += 1 when ever a key ...
6
votes
1answer
270 views

Swaying Camera when Walking

You can see the effect in many games. The camera sways or wiggles a bit while walking to make the movement feel more realistic. I have implemented a camera in my game. (Who'd have thunk it?) So is ...
6
votes
1answer
687 views

What are some good methods of implementing RTS-style Box selection?

i'm just scouting around for different methods of implementing a typical rts box selection (not the 2D box on the screen, but what units are selected with the box) when selecting units, and would ...
6
votes
2answers
2k views

What would be a good game making engine supporting Vector images?

I want to create a simple platforming game, in which you are a square in a wonderful world. I would like this game to be able to be played in browsers. Basically I am searching for something similar ...
6
votes
1answer
167 views

How to prevent clipping when moving through a tunnel?

I'm developing for Android using OpenGL ES 2.0. It's going to be a game where you have to fly through a tunnel without hitting the walls. However, the tunnel wall gets clipped as the player ...
5
votes
3answers
866 views

What does it mean to “strafe” the camera?

I'm looking at a tutorial in which both the terms camera moving and "strafing" are used. I looked onto dictionary.com and found: strafe verb (used with object) 1. to attack (ground troops or ...
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 ...
5
votes
2answers
949 views

What's a pre-multiplied 4x4 matrix?

I'm using a 3d game engine, that uses a 4x4 matrix to modify the camera projection. The matrix is in the regular 4x4 format: r r r x r r r y r r r z - - - zoom The description for the ...
5
votes
2answers
1k views

Why is my Unity camera chasing player script running slow?

I have a camera class, that is suppose to chase my player, which works, but its really really slow. It only has this line of code, which makes sense to me, player moves, camera moves. Any idea of why ...
5
votes
2answers
222 views

What perspective is suitable for sharing a screen across a table?

I'm thinking about a 2 player 2D arena game for a mobile phone, but I have the obvious problem of gripping. To avoid this, I think it shouldn't be a problem to play one in front of the other with ...
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 ...
5
votes
1answer
581 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 ...
5
votes
2answers
537 views

Manipulating a free camera

I have a camera class in my code which stores two 4x4 matrices. One for the view matrix and one for the projection matrix. Originally, I had two floats in the class for pitch and yaw and these were ...
5
votes
2answers
633 views

Recommended 3D camera settings and model sizes for an FPS

I'm making a simple FPS and I can't decide on the size of my models and my camera settings. Could someone please recommend a good combination of: camera field of view near and far planes model ...
5
votes
2answers
3k views

Keeping the camera from going through walls in a first person game in Unity?

I'm using a modified version of the standard Unity First Person Controller. At the moment when I stand near walls, the camera clips through and lets me see through the wall. I know about camera ...
5
votes
2answers
1k views

Detect if a sprite has left the camera in libgdx?

Is there a method to know if a sprite has left the camera of the stage? or I have to do my operations? :P
5
votes
3answers
2k views

XNA 4.0: 2D Camera Y and X are going in wrong direction

I asked this question on stackoverflow but assumed this might be a better area to ask it as well for a more informed answer. My problem is that I am trying to create a camera class and have it so ...
5
votes
2answers
2k views

How to rotate camera centered around the camera's position?

Currently I am using gluLook at like so: gluLookAt(position.x, position.y, position.z, viewPoint.x, viewPoint.y, viewPoint.z, upVector.x, upVector.y, upVector.z); with the ...
5
votes
2answers
535 views

Rotating object around moving object/player in 2D

I am trying to implement a camera which rotates around the world around the player. I have found many solutions online to the task of rotating an object about the origin, or about an arbitrary point. ...