Arithmetic, geometry, calculus, and all else which resolves the number-crunching necessary in a game. Math questions are those that deal with the formulae and calculations used by the game in various parts.
0
votes
0answers
27 views
Movement Around Sphere 3D
I am trying to control a ship that orbits freely around a sphere at a fixed distance. The ship is currently controlled by a joystick which returns values for x and y between -1 and 1. Currently the ...
1
vote
1answer
42 views
2D car physics and high speed turning
I've been looking at the following page, which has been very helpful: http://www.asawicki.info/Mirror/Car%20Physics%20for%20Games/Car%20Physics%20for%20Games.html but have come into problems with the ...
3
votes
1answer
43 views
Matrix Translation Transformation Question
I've been reading a lot about computer graphics lately and because of it I'm building my own math library's for fun. I was reading about Matrix Translation and Homogeneous Coords, and was wondering ...
2
votes
2answers
102 views
Defining an OpenGL unit
I have read that you can define your OpenGL unit by using glViewport.
As far as I understood if you use something like glViewport(0,0,600,600) then 1 OpenGL unit = 600 pixels. Now my problem is what ...
2
votes
2answers
135 views
Why does matrix multiplication lead to different result if it's done on CPU, compared to GPU(shader)?
If I'm calculating a "camera space" on the CPU, by multiplying the view with the projection matrix on the CPU , and afterwards multiplying the world to the result my vertices do not pass to the pixel ...
2
votes
1answer
90 views
Get intersected volume of two planes in 3D
I'm working on AABB - AABB collision response and I'm having trouble figuring one part out. My situation is as follows (see image).
I have a player AABB (blue) and an object which collides (brown). ...
5
votes
3answers
208 views
How can I change the acceleration of an object to arrive at a particular time?
I'm trying to write some code to change an acceleration factor so a ball will arrive at a destination in a desired time.
The problem is I don't know time (t) but I do know I want it to arrive at (t - ...
-3
votes
0answers
91 views
How to determine value for players in a fantasy sports game?
I'm doing research for creating a fantasy sports game. One piece of the puzzle that I'm particularly interested in is the part that determines player value.
I imagine there is a technique for doing ...
1
vote
1answer
64 views
Movement constrained to the faces of a cube
The basic setup I'm working with is a cube rendered in-Engine (Panda3d, although I only am looking for a generalized solution) as well as a 2d square on one face of the cube. The eventual outcome I'm ...
4
votes
1answer
124 views
What happens to data between vertex shader and pixel shader?
Short version: What can happen to the output of a vertex shader that leads to no(or very few) pixels being drawn, especially in relation to a perspective matrix.
Long version:
My problem refers to ...
5
votes
1answer
173 views
A* for non grid network
For my specific case, I am trying to find a path finding implementation similar to what described here.
I could see reference implementation for A* and HPA*, but I wonder how to extend A* to simple ...
1
vote
1answer
59 views
Creating a frustum for culling in world-space glm matrices
I need to do frustum culling where the bounding boxes are in world-space to determine which entities get to be updated/drawn. I was trying to use the classic projection/view matrix plane extraction ...
1
vote
5answers
186 views
how to rotate enemy to face player? [duplicate]
Okay so i havebeen rotating my enemy to face the player using
float targetrotation = Math.Atan2(playerpos-enemypos);
enemy.rotation = targetrotation; (<this line of code i want to change)
This ...
0
votes
1answer
59 views
Jump function of player [duplicate]
I'm developing game in marmalade sdk in c++. I have player in the area.and I wanna make him jump when i pressed a button.When I use this player.moveUp(5px); it just go up 5px, but he has to fall down ...
0
votes
3answers
74 views
How to calculate size of object depending of its height on the screen?
I am programming a mostly 2D game on Android (with Andengine), but the player is a bouncing ball (kinda in 3D).
I wanted to make the bouncing of the ball the most realistic possible, using quadrilic ...
1
vote
1answer
44 views
Build a Cube/Prism from other varied Cubes/Prisms [closed]
I'm wondering, are there any algorithms or theories in existence (that aren't patented/proprietary/protected) that would take a series of 3d rectangular prisms (or cubes but a cube is a prism) and ...
5
votes
2answers
130 views
Plotting entities on a radar
I'm trying to build a radar system like the one in the original X-Wing games. The way it works is that there are two circular radar systems, one for behind the ship, and one for infront.
So, I've ...
5
votes
4answers
244 views
+300
Converting a 2D curve into points for data storage
I’ve created an algorithm which converts any curve i.e. path into minimum number of points so that I can save it into a file or database.
The method is simple: it moves three points in equal steps ...
3
votes
1answer
208 views
3D isometric depth sorting
How is it possible to depth sort tiles and objects in an isometric environments without any limitations? I've been researching this for a while now and there seems to be no publicly available answers ...
2
votes
1answer
89 views
AABB of a sphere's screen space projection
What is a nice, neat way to get the AABB of a sphere's projection onto the screen? This is to determine simplified geometry for lights in deferred shading.
1
vote
2answers
107 views
Distribute circles evenly on Screen - circle packing
I want to evenly distribute a random amount of circles with random diameter on the screen for. This level doesn't scroll so the users screen resolution sets the limits. Further I would like the ...
2
votes
2answers
171 views
Bezier curve not drawn correctly
I'm trying to draw a bezier curve using 3 points. If I use the quadratic form:
I get this result:
And I believe it's correct.
Now since I need to draw it with a variable number of points, ...
2
votes
1answer
75 views
Physics movement prediction is way off [closed]
I'm making a simple, non-networked game. There are two players and a ball. In implementing the AI for the second player, I've run into a huge problem predicting where the ball will hit the ground. ...
0
votes
0answers
33 views
Cascaded Shadow Maps left handed to right handed coord system
Im trying to port the Directx SDK (june 2010) sample (CascadedShadowMaps11) into a right handed version (to later implement in my engine) but i can't figure out the math, so far i got it partially ...
0
votes
4answers
187 views
A formula for point calculation based on value A's proximity to value B
I am trying to find a formula to use for my rhythm game's scoring. Basically there is a Guide entity and a Live entity. You control the Live entity and have to match it as closely as possible to a ...
6
votes
2answers
207 views
How can you extract orientation from a transformation matrix?
I have a 4x4 transformation matrix M, and I want to find out the shape of a sphere when transformed by M. (Sphere is at the origin and has radius 1.)
I know I can find the center by just multiplying ...
0
votes
1answer
61 views
Increase restitution (bounciness) of an object in a JavaScript formula
I'm going slightly around the houses on this one. I originally started a thread over on Stack Overflow about it but then it seemed to diverge into mathematics, with no joy from the SO community over ...
3
votes
2answers
218 views
How do I calculate consistent frame timings at 60fps?
I'm writing an HTML canvas game that uses requestAnimationFrame and therefore runs at 60fps, although this is more of a question about failing arithmetic than about JavaScript.
If I measure the time ...
2
votes
1answer
80 views
How to rotate a direction
I'm working a spotlight for my deferred renderer and I'm having trouble with matching the mesh to the visual representation of the light. Right now my mesh is a cone, the apex of the cone is at ...
0
votes
1answer
178 views
How do I detect the intersection of a curve with itself?
I'm developing a game in which the player can draw a line. I want to detect if that line intersects with itself. How would I do this?
1
vote
1answer
98 views
Any book about math in game design? [closed]
Game designers need math as one of their tools for designing game, unfortunately I can't find one book concentrate on this topic. I know there's math book about game programmer, but designer need ...
-2
votes
1answer
97 views
In a regular grid, how can I tell which tile a position is in?
I have a position on the screen, how do I calculate which grid tile that position is inside?
I know the number of tiles in the grid, and the size of the screen (including how many tiles fit on it ...
3
votes
2answers
169 views
How does a point squared equal the radius squared?
I am working on a simple ray tracer but I don't understand some of the formulas.
One that is bugging me at the moment is this:
If a sphere is centred at origin, a point p lies on a sphere of ...
2
votes
2answers
97 views
2D field of view detection inverted
I'm not sure if the title matches what I'm actually facing
I'm trying to test if I can see a point is in my field of view (in the context of an NPC seeing in it's direction.)
I know that:
cos0 = ...
0
votes
1answer
159 views
Please help me with my 2D isometric tile picking [duplicate]
Possible Duplicate:
How to convert mouse coordinates to isometric indexes?
Okay, I apologise in advance if I make no sense here.
Basically, I've got a simple application that takes in a ...
2
votes
1answer
120 views
How to do perspective projection “parallax” but without changing the scale or offset of objects?
Hello everyone I have this problem that I have tried everything I could think of. The problem: I am making a 2D game with parallax effect but I am using 3d space so am not simulating the parallax but ...
2
votes
2answers
189 views
Derive a algorithm to match best position
I have pieces in my game which have stats and cost assigned to them and they can only be placed at a certain location.
Lets say I have 50 pieces.
e.g.
Piece1 = 100 stats, 10 cost, Position A.
Piece2 ...
2
votes
1answer
191 views
Drawing isometric walls
I'm having some trouble with isometric walls.
I'm drawing isometric floor tiles using the back to front rendering method, and it works fine. I also keep my floor tiles lined up properly in a nice ...
0
votes
0answers
133 views
How do I implement a physics gun?
I'm currently trying to implement a physics gun for my game. What I want is for the entity to stay in the same position on the screen no matter how I wiggle the camera about, what is the correct way ...
0
votes
1answer
58 views
Find the footprint of an isometric entity
I'm working on making a 2D isometric engine in Java. I'm getting into collision detection and I've hit a bit of a problem.
Characters in-game are not restricted to movement from tile to tile - they ...
3
votes
1answer
52 views
Retrieve outer most points on a 2d graph
G'day everyone,
I have a 2d graph which has some points plotted on it.
What I need to do is get only the outer most points so that I can connect them up (isn't really relevant).
What I can't seem ...
2
votes
0answers
98 views
Catmull Rom Spline - Constant Speed
Given the equations found in the answer here:
Determine arc-length of a Catmull-Rom spline
How would one A) Apply this to a 3D Catmull-Rom Spline, and B) write A out programmatically (for the math ...
4
votes
1answer
108 views
Orbiting multiple objects evenly around a changing radius
I have multiple objects (circles) and I want to place them in a circle, with even distance between each one, and have them orbit the center of the screen.
If I remove one object, I want the orbit ...
2
votes
1answer
200 views
360+ degree rotation skips back to 0 degrees when using Math.Atan2(y, x)
I'm new to XNA and this is my first actual project, so forgive my noobness.
I'm using
jointAngle = System.Math.Atan2(RightStick.Y, RightStick.X);
in order to set an angle of a joint (farseer) so ...
2
votes
1answer
126 views
Min/Max of two vectors?
This seems like a simple question, but i'm having trouble searching the internet for it.
In XNA, during a collision detecting method, I would determin the minimum of some vectors.
// Get the minimum ...
0
votes
1answer
75 views
getting direction of x and y… north,south,east,west
I have a player in the center of the screen, where I also have my mouse position origin. (0,0) I would like to know the direction of the mouse, imagine splitting the screen with a X, so the top ...
4
votes
1answer
68 views
What OpenCL video cards (or FPGAs) features are needed for high speed multiplication?
I'm benchmarking some cryptographic related software and am looking for video cards that are better at parallel multiplication vs parallel addition.
Is there any prior work that would graph video ...
1
vote
1answer
206 views
Understanding math used to determine if vector is clockwise / counterclockwise from your vector
I'm reading Programming Game AI by Example by Mat Buckland. In the Math & Physics primer chapter there's a listing of the declaration of a class used to represent 2D vectors.
This class contains ...
-1
votes
3answers
154 views
Scale a normalized 2D vector always to the same length
For any normalized 2D vector, except for ( 0, 0 ), how would I scale the vector to always be the same length?
For example:
int length = 10;
vector v = vector( 0.1, 0.5 );
vector v2 = vector( 0.3, ...
3
votes
0answers
165 views
Isometric - precise screen coordinates to isometric
I'm trying to translate mouse coords to precise isometric coords (I can already find the tile the mouse is over, but I want it to be more precise). I've tried several different methods but I seem to ...