The viewpoint from which the game world is observed from.
43
votes
8answers
5k 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
...
29
votes
1answer
3k 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 ...
27
votes
5answers
3k 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 ...
19
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 ...
14
votes
5answers
944 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 ...
13
votes
5answers
784 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 ...
12
votes
1answer
194 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 ...
11
votes
3answers
3k 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 ...
11
votes
2answers
661 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 ...
10
votes
2answers
573 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 ...
10
votes
1answer
290 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 ...
9
votes
2answers
6k 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 ...
8
votes
4answers
986 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
300 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
398 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
404 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
2answers
404 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
699 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
833 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
677 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
413 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
3answers
3k 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 ...
6
votes
1answer
376 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 ...
6
votes
1answer
381 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
827 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 ...
5
votes
3answers
667 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
3k 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
3answers
647 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
227 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 ...
5
votes
2answers
697 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
143 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
1answer
163 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 ...
5
votes
1answer
505 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
457 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
452 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
3answers
893 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
3answers
1k 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
154 views
Calculate new coords of camera after a 90 degree rotation in an isometric 2D projection
I made a 2D isometric renderer. It works fine but now I want to show my scene from 4 different points of view (NE NW SE SW) but, on a 90° rotation, my camera cannot keep the center of my scene on ...
4
votes
1answer
132 views
Why does CameraZ=0 result in no render?
I am trying to draw simple model, but I am experiencing strange error. When I use this View matrix:
Matrix.CreateLookAt(new Vector3(0, 200, 1), new Vector3(0, 0, 0), Vector3.Up);
my model is drawn ...
4
votes
1answer
462 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 ...
4
votes
1answer
857 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, ...
4
votes
1answer
603 views
How can I achieve a zoom-like camera effect?
I have a top down 3D camera:
view = Matrix.CreateLookAt(new Vector3(0,0,20), Vector3.Zero, Vector3.Up);
Now I want to achieve the effect like when I zoom in the scene and only show a section at the ...
4
votes
1answer
270 views
Getting the Bounds of a 2D Cameras View with Zoom
I am using a 2D camera, which does rotations and zoom. Currently, I am using the following to get my MinX, MinY, MaxX and MaxY...
public float MinX
{
get
{
return ...
4
votes
4answers
458 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 ...
4
votes
2answers
1k 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 ...
4
votes
1answer
661 views
Improving first person camera and implementing third person camera
I want to improve upon my first person camera implementation and extend it to, so the user can toggle between third person/first person view.
My current setup:
draw()::
glPushMatrix();
...
4
votes
1answer
801 views
FPS Camera Look Direction
I'm using XNA to create an FPS camera that uses a Direction vector instead of a Target vector control the camera's orientation.
I'm having trouble with the math for looking up and down when the ...
4
votes
1answer
225 views
How do I calculate the boundary of the game window after transforming the view?
My Camera class handles zoom, rotation, and of course panning. It's invoked through SpriteBatch.Begin, like so many other XNA 2D camera classes. It calculates the view Matrix like so:
public Matrix ...
4
votes
2answers
169 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 ...
4
votes
4answers
919 views
From camera coordinates to world coordinates
I want to calculate world coordinates from camera coordinates. However, I seem to have problems with my understandings of how matrices in HLSL work.
From world to camera is clear:
cameraPosition = ...