Mathematics questions deal with the arithmetic, geometry, calculus, formulae and other calculations used in the development of a game.

learn more… | top users | synonyms (1)

1
vote
3answers
124 views

Why do we refer to a “model view” matrix and not a “viewprojection” matrix?

Why there is a model-view matrix, but not a view-projection matrix? A view-projection matrix would make much more sense to me, since every entity in the scene has his own position and therefore its ...
2
votes
2answers
497 views

What is the difference between an orthographic and oblique projection?

They both seem to be a parallel projection. I know that the angles of axes of viewing differ based on the type of orthographic projection (eg, an isometric projection has equal angles for all the ...
1
vote
0answers
45 views

Unintended twisting of geometry while generating a mesh?

I am creating a real time animation of tori (toruses), and I've run into a problem where at certain angles of my tori, the geometry is twisting up where it should remain straight. Here is an animated ...
0
votes
1answer
40 views

Organizing a Transform class to internally use quaternions

So, I'm interested in building a Transform class similar to the one used in Unity Engine, but in C++. My intent is for it to be user-friendly to change the position, rotation, and scale of a variable ...
-3
votes
0answers
34 views

How to see math formulas from StackExchange in my web browser [migrated]

I would like to see maths formula as maths formula in firefox. It is possible ? For instance, for the page link, I just see maths formulas as $$..., and I would like to see interpreted formulas. ...
0
votes
0answers
66 views

3D Game Rendering (Educational purposes) [closed]

I've been programming off and on for a few years, and have made several 2d games in java. (I also know c# and a bit of c++). I was wondering where I should start off for rendering 3D scenes in java ...
0
votes
1answer
37 views

Determine if Plane is seen by Camera

If I have an arbitrary plane (center and normal) or a quad (center, normal and width and height) and a camera (frustum, projection & view matrix, etc). Then how would I go about calculating if the ...
2
votes
0answers
81 views

Understanding normal mapping

I am trying to understand the basics of normal mapping using this tutorial : http://ogldev.atspace.co.uk/www/tutorial26/tutorial26.html What I don't get there is the following equation : E1 = ( U1 - ...
0
votes
0answers
10 views

Smoothly scaling positions of GraphicsItems on a 2D GraphicsScene

I layout a bunch of nodes on a QGraphicsScene(A 2D Canvas). The nodes are basic ellipses. It works reasonably well. However I would like to know how to better size the ellipses. Currently I have a ...
0
votes
1answer
52 views

Controlling roll rotation when travelling along bezier curves [Unity3D]

I am currently working on implementing a curve implementation for use in Unity which includes an editor: The aim is to get an object to follow the path represented by the curve at a constant ...
0
votes
1answer
47 views

Affine transformation: rotate a plane parallel to another plane

I am writing a function that extrudes a 2D shape along a 3D spline, as found in 3D modeling software. I need a way of translating a set of points P so that they all lie in a new plane L (preserving ...
0
votes
1answer
38 views

How to move a car model on a plane?

I want to create a 3 dimensional car game. But i have a problem in moving a car in other directions and accelerating. I have a car model and a road model placed appropriately. To move car forward, I ...
1
vote
1answer
68 views

What is the purpose of integration in physics engines?

All online resources seem to assume that you know what this means and/or state that this is related to object movement in some way. How does this differ than just position.x++ and position.y++ and ...
0
votes
1answer
50 views

Path finding for Vector Based System

I understand that typical path algorithms are based on nodes in a graph (not tiled nodes or whatever), but i can't get my head around to find an idea how to implement a path finding algorithm for a ...
1
vote
2answers
66 views

Rotating an object towards a target on the Y axis

I am attempting to rotate a 3D object on its Y-axis towards a target it is looking at. I have always struggled with rotations so I would like to try to avoid using Unity's built in functions, i.e ...
1
vote
1answer
36 views

Finding the side of a shape a ray intersects

For some simple 3D shapes (cubes, prisms) how can I determine which side a ray intersects, knowing the direction of the ray, and the normals of the shapes' sides. I thought of using plane ...
0
votes
1answer
56 views

Calculate slope for linear interpolated movement

I want to move rectangles to their targets the "smooth" way with linear interpolation. I hope this is right. float slope(float x1, float x2, float y1, float y2) { return std::abs((y2 - y1)) / ...
0
votes
1answer
56 views

Normalizing a homogeneous 3d point

As I've seen corruption in geometry, why is it a bad idea to normalize a homogeneous (divide by w) the vertex position returned from vertex shader? Update Vertex shader: // float4 pos : ...
0
votes
1answer
82 views

Ray->triangle collision math seems to not work?

First time asking, pardon any mistakes I make :) I am programming a game from scratch, and the collision detection is giving me issues. I have AABB in place to check proximity, and if that reacts, ...
1
vote
1answer
64 views

Understanding constant acceleration in terms of game physics simulation

There are various integration methods that can be used for games. I am trying to write a simple physics engine deciding between semi-implicit Eular and Verlet variants. What I don't understand is ...
1
vote
1answer
26 views

Vector magnitude in orientation

First, a quick overview of my problem: I have a game entity which has a quaternion to represent its rotation/orientation. It also has a 3D vector in world space for its linear velocity. From the ...
2
votes
2answers
116 views

How to calculate a 3D orientation from 2D vanishing lines on an image?

Let say I have a image that represent a 3D scene. I did not have the 3D camera orientation of that scene (left, up and forward vectors) and i'd like to calculate it. On that picture, I draw the ...
0
votes
2answers
61 views

Rotating point around another point

I can't manage to rotate point around another point. I did some searching around google and found algorithm that should work and it kinda does but it also moves the point I am rotating closer to ...
5
votes
4answers
1k views

What is the simplest way to calculate distance in a 3D environment?

What is the simplest way to programmatically calculate difference between two points in a 3D game environment? I am trying to sort a list of light sources by how close they are to an entity, so that ...
0
votes
1answer
118 views

Vector-based Pong-ball bounce calculations

I'm making a 2D game with pads and balls, sort of like Pong, in Unity 4.6.1. The calculations, however, won't be (very) Unity-specific. The pads are going to appear in various rotations, and therefore ...
1
vote
1answer
60 views

“aim at” in 3D space algorithm

I'd to calculate the cartesian rotate values of "aiming" one point at another in 3D space. For example, assuming rotation order of XYZ: Point A is at [0, 0, 0] Point B is at [2, 2, 0] If point A was ...
0
votes
2answers
63 views

How to get quaternion from two orthogonal 3D vectors?

I have a unit vector representing the direction I want to "look" and a unit vector for up. They are orthogonal. How can I get the quaternion that represents that orientation from those two vectors?
2
votes
2answers
93 views

How do I model diffusion and heat?

So I'm trying to solve a heat/diffusion equation for a continuous space, but I'm not opposed to a grid solution. I'm a little short on the maths needed but have made it work so far. If I model ...
0
votes
1answer
47 views

How to reposition a bouncing ball after it has passed through a surface

I have a bouncing ball which can collide with lines of a random slope. The ball passes through the lines a bit and I need to set the ball back some distance from the line. The ball (defined by ...
0
votes
1answer
79 views

Separation of axis theorem implementation at normals

This might be more of a math question, but it relates to the development of a simple physics engine I am trying to create. I have been stumped on this for about a week now, and have been unable to ...
3
votes
1answer
131 views

How to construct the marching cubes tables algorithmically?

I want to implement the marching cubes algorithm from scratch, but I'm stuck at the polygon generation phase (building edge loops with correct orientation and triangulating them). Obviously, I should ...
5
votes
5answers
2k views

How can I test whether points are within a polygon?

I have 2D-points, which boundaries depict a polygon. The points are at integer positions (no fractions possible). Now I want to build an enumerator in C# that returns all points that are inside the ...
0
votes
1answer
51 views

Launch Velocity for Simple 3D Projectile [duplicate]

This is a pretty easy question, but I can't quite figure out the answer. I have: The initial position of a projectile. The gravity vector. The (stationary) target I want to hit. A maximum launch ...
1
vote
2answers
49 views

Translating Objects in Worldspace

Given the worldspace coordinates of a collection of arbitrarily positioned objects, how do I translate them while preserving their relative placement? For instance, I have a table and a few bowls that ...
4
votes
1answer
178 views

How to calculate a direction vector for camera?

I have a vector that describes change in movement, and I have a 3d-vector, m_rot, that describes a rotation given to an object. I want to calculate a direction vector using both this data. How to ...
0
votes
0answers
24 views

Connecting a model's joint to the joint of another model

I am trying to figure out the math behind orientating and translating a model so that a specified point on the model will connect with a specified point on another model. For example, given the ...
0
votes
2answers
112 views

Trajectory of a spinning ball

How do I would precalculate trajectory of a kicked ball, when it's spinning? I'm applying spinning using simplified Magnus effect every frame like this and it works: acceleration += swerve × ...
1
vote
3answers
96 views

How do I interpret the dot product of non-normalized vectors?

I know that if you take the dot-product of two normalized vectors, you get the cosine of the angle between them. But if I take the dot-product of two non-normalized vectors (or one normalized, one ...
18
votes
5answers
3k views

How can I come up with a simple diminishing return equation?

There are formulas out there for a diminishing return equation; however, those usually involve exponential. What other ways are there for coming up with such an equation? Take, for example, the ...
0
votes
0answers
20 views

Robust algorithm for ray-isosurface intersection (with depth discontinuities)

For Dual Contouring, I need to calculate the precise intersection '(zero-crossing point') of any line ('segment', 'ray') with the given isosurface ('distance field', 'density source'). The algorithm ...
0
votes
1answer
49 views

Rotating a 3d vector around an axis using sines and cosines

I am trying to represent a 3d cone light's direction using only 2 variables. Right now I represent it with two points (6 variables) but I know that the direction in 3d space can be represented by two ...
0
votes
1answer
43 views

Problematic cameraposition (Eye = (0,0,0), at=(0,-2,0) and up = (0,1,0))?

I am taking a course in computergraphics and we talk a lot about OpenGL and the math you need to do everything OpenGL does "by hand". A Question which was asked in an old exam (I am preparing at the ...
-1
votes
1answer
53 views

Simulating aircraft movement with DirectX 9 [closed]

How would I go about simulating a planes movement in DirectX 9 using transforms (i.e. matrices). For example flying around an open space. When it moves it faces the direction it is going and ...
2
votes
1answer
111 views

Weird effect when generating gradients for height map

I am experimenting with generating height maps using radial gradients and perlin noise, using a technique I found here: ...
3
votes
1answer
110 views

Fastest way to find closest triangle of mesh from specified point

I have two triangle meshes (let me call them A and B). The meshes may be really big (10.000 - 100.000 polygons). I want to find for every point in A the closest triangle from mesh B. Is there fast ...
2
votes
1answer
89 views

How can I position a sprite in the same spot across different screen sizes?

Taking into account the multitude of screen sizes and resolutions, is there a way I can position a sprite so it's at roughly the same spot on every iOS device? Doesn't matter if you are using ...
0
votes
1answer
96 views

Formula to measure uv-mapping distortion

Does anyone know a simple way of calculating (offline) the amount a texture is distorted when mapped to a triangle like the following? Vertex Position UV Coordinates A (Ax, Ay, Az) ...
12
votes
1answer
2k views

How do I tell if my enemy can see my player?

Given a player and an enemy with position, and given the direction vector of each, how can I tell if one can "see" the other? In other words, how do I test if one position with direction is in front ...
0
votes
1answer
62 views

Gravity: Slow down on ground approach

I'm looking for some math, nothing language dependant. "Standard" gravity for a character in a 2D game would go something like this: if player.y > ground.y { player.velocity.y = ...
0
votes
1answer
103 views

Scaling a UI bar for progress in Unity

I have created a progress bar inside Unity for one of my energy systems. The bar progression works fine. Its just a plane pivoted on one of the faces so scaling it in x axis makes it progress further ...