Tag Info

New answers tagged

0

Orthographic projection can be done in advance, making it simply a 2d game with a tileset constructed either: from a 3d model with orthographic projection on (in blender you can set this in the camera's object data properties window), or by manually drawing the pixels. This way you bypass the need for projecting at runtime, which will make the game ...


5

And literally 1min after I post the question I found out the answer. The problem was that on my projection matrix creation the width and height are integers, and thus the aspect ratio would be always 1. I changed the width and height to floats, and it started working.


1

I guess that the problem lies in here: _up = Vector3.TransformCoordinate(Vector3.Up, rotateYTempMatrix); You're calculating the up vector (and also the rest of them) from a matrix unrelated to the cameraRotationMatrix matrix, in which you have stored the new rotation. Usually, what I do is multiply an old rotation matrix by the new rotation ...


0

If the tiles are stored in a linear way( sorted so that the top left tile is first and the bottom right is last, or some other reasonable order ), you can access the array / list by an index that describes tiles that only lay within the screen bounds. This will be a bit faster than doing a bounds check every tile. Tile[,] tiles = new Tile[x,y]; We can now ...


2

The simplest way to do this is to compute a correcting rotation every time the camera moves: axis = cross(newPosition, oldPosition); angle = acos(dot(normalize(oldPosition), normalize(newPosition))); ...and then rotate the camera's orientation matrix/quaternion/basis vectors by this correction. But since the movements are likely to be small and frequent, ...


0

You are talking about tiles, therefore i'm assuming you are talking about a 2d game. You need to have the camera position in the world like so: int cameraX = 0; int cameraY = 0; You also need to have the camera size, which is usually the same as your viewport size: int cameraWidth = viewportWidth; int cameraHeight = viewPortHeight; Then you can find ...


0

It looks like your x,y,zoffset variables are set up for the camera in its default position (say, "South" of the player), and don't update when the camera is turned (say, to put the camera "West" of the player) - so when you perform the skill, the camera teleports back to its initial ("South") offset, which puts the player off-screen to its left. I may be ...


0

I'm using this transform: x' = [cos(phi), 0, sin(phi)] y' = [-sin(phi)sin(theta),cos(theta),cos(phi)sin(theta)] z' = [-sin(phi)cos(theta),-sin(theta),cos(phi)cos(theta)] Write these expressions into rows and you've got yourself a transformation matrix. The third parameter (rotation around the z' axis), can be handled like this: x'' = x'cos(alpha) + ...


0

I honestly do not get this FPS/Arcball/Whatever camera nonsense that is going on. Just implement a general purpose camera, with either a transformation as 4x4 matrix or a position as R3 vector and orientation as a 3x3 matrix or quaternion. Then think about how that camera is moving though space. For example I have implemented a general purpose camera with a ...


1

Ahahaha, problem solved, I'm such a math genius ^^: my math library had a typo in function that converts quaternion to a matrix : 1 - 2 * (this.y * this.y - this.z * this.z); - minus times minus makes plus, not minus, as in here: http://www.gameprogrammer.net/delphi3dArchive/quaternions_bestanden/quat1.gif


0

Using following code, I can able to get success in this doubt. Camera camera = GameHUD.this.getCamera(); float[] position = camera .getCameraSceneCoordinatesFromSceneCoordinates(GameManager .getInstance().getMainCharacter().getX(), GameManager ...


4

What you are looking for can be found in this very good explanation: http://www.songho.ca/opengl/gl_transform.html But since I found it sort of confusing without hand holding I will try to explain it here. At this point you need to consider 5 coordinate systems and how they relate to each other. These are the window coordinates, the normalized device ...



Top 50 recent answers are included