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)

0
votes
1answer
29 views

Gravity wells that go with finger

I have a simple particle game, where all the particles are arranged in a grid. This game is for touch devices so to take advantage of it I am trying to have a multitouch gravity field thing going on. ...
0
votes
0answers
74 views

I want to sell my game ideas [on hold]

I have multiple ideas for video games that will alter today's thinking, and i want to sell my ideas. Or in better approach i would like to partner up with a company and make my vision a reality. How ...
0
votes
0answers
19 views

Resizing a procedurally generated arc mesh

I have a script that generates a mesh representing a 2D arc. This arc is generated when the game starts based on a size (radians), width, etc... I would like to know if there's any fast way to resize ...
1
vote
2answers
74 views

Get the difference between 2 matrices

Hi I'm using C# and MonoGame, and have the world matrices of 2 objects. I need to get the difference between them, so I can effectively parent the second object onto the first. The aim is to get to a ...
0
votes
1answer
32 views

How to move 2D objects based on mouse movement with pointer locking?

I'm using pointer locking for a 2D game (where you perform calculations based on the delta in mouse positions from frame to frame). I'm having some basic math/logic issues with accomplishing what I ...
-1
votes
0answers
9 views

calculate ray picking using directx11 [duplicate]

I'm trying to generate a ray to check which objects has been picked. I want to check the math if its correct or no, because when I try to draw a ray, Its not visible at all, and the ray origin is in ...
0
votes
1answer
54 views

Getting the Right Vector from the Forward Vector

I'm currently working on a small Camera (ArcBall) and I finally am starting to understand how it will work. I will first create a basic View Matrix using a LookAt function. Then, I will send the ...
1
vote
0answers
35 views

Rotation of a point around axis using quaternions

I have a simple processing program to rotate a point around arbitrary axis but it stops after a bit. I'm trying to get full rotation of the point around the axis. import ...
1
vote
1answer
54 views

Dynamic force behind logical jumping on 3 axis'

I've been working on physical jumping in a 3D environment, I've got it working with a static force. The problem with this is that the force on each axis should be different due to the rotation from ...
1
vote
1answer
67 views

Logical math behind jumping in a 3D world

I'm unsure if I should ask the mathematic part of StackOverflow or the gamedev part. I'm trying to figure out how the gravity changes the position of an element in a 3D world. I've been trying to ...
0
votes
1answer
26 views

Will points on path with width intersect

I want to be able to check if a list of points will hit a screwed rectangle (rhombus i think). I start out with 2 point P and T, i want to create a rectangle between the 2 points. I have used ...
1
vote
1answer
60 views

Calculate XP needed for next Level using this simple algorithm?

I am currently calculating the Levels in my game using the following forumla: player.level = mathFLOOR(mathMAX(1, 0.05 * mathSQRT(player.score)) * (1 + player.kd / 10)); So the level is based on ...
0
votes
1answer
26 views

Position of an object relative to another in a 2D plane

I have two objects, A and B, each of them has a set of coordinates (x,y). How do I understand where is A in relation to B's position? If I where to just check each coordinates I could do it like ...
0
votes
2answers
37 views

Turn Radii and speed calculations

Ok guys I'm an aspiring game designer and I'm trying to develop a racing board game using real life as a basis for my mechanics. The problem im having is I'm not very mathematically inclined I found ...
3
votes
1answer
68 views

How to make expanding ring with constant thickness?

I need to generate this burst or (donut-shaped) pulse. I'm having a difficult time how to generate such shape. At first, I was thinking of scaling the image but that didnt work out because the line or ...
3
votes
2answers
158 views

10 weapon types, 2 proficiencies, rock-paper-scissors relationship?

I want to make a game where there's a total of 10 general weapon types. I want any given character to be able to be proficient with 2 of the weapon types. Looking at the fact that 10 is an even ...
1
vote
2answers
57 views

Maths ? coordinates rotating around coordinates

could you geave me a tip please, a redirection to what is the "simple" math I need to learn and understand for the rotation of an object (its coordinate x, y) around an other object (an other x, y), I ...
8
votes
2answers
458 views

Guided Missile with Constant Time

I'm building a game with players and missiles. I want to fire a missile from P1 to P2. The missile should always take exactly five seconds to reach P2. The missile should also track P2. If P2 moves ...
0
votes
1answer
105 views

libgdx - Math for wall collision when adding velocity

I've created a game which spawns a random colored ball in the top or bottom of the screen and moves to random direction with this method. private Vector2 position; private Vector2 velocity; private ...
0
votes
0answers
44 views

Dot product not working as expected

Recently I am learning dot product, While below code works from Unity's documentation, http://docs.unity3d.com/ScriptReference/Vector3.Dot.html public Transform other; void Update() { ...
1
vote
1answer
64 views

Rotating A model in 3D so it matches its direction of movement

So I have a model of a spear and when it gets thrown I want to set the orientation of the spear to its direction. ( I also want to use this for other things like bullets pointing in the direction ...
0
votes
0answers
37 views

How to spin a 2D quad in place using only matrices?

In short, I have a textured 2D quad (a sprite). I would like to rotate/spin it about the z-axis (coming out of the screen) using nothing but matrices. If I do the following to a transform with scale ...
1
vote
0answers
17 views

A question about Decal projection

From my understanding, there are several different ways to implement decals, from screen space, to copying geometry, but I can never find an explination of it's math. So what exactly is the math ...
2
votes
3answers
128 views

Accelerated movement in a specific time to a specific point

I am trying to move my sprite in a specific time to a specific position while using frame-independent or time-dependent movement. My sprite is also accelerated every frame to simulate gravity. I know ...
8
votes
2answers
871 views

Get water flow direction vector from water normal vector

Im stuck developing an important detail of my game water: Making it flow downwards! Considering a typical 3D world in wich water tends to go towards gravity g=(0,-1,0) , and having the normal of the ...
1
vote
2answers
93 views

Calculate values in a game, which depends from stats and balance them

So, I am basically lost at this point, trying to balance things. In design phase; I did assign certain values to stats (imagine a standard set of any RPG you ever playe, to make things streamlined). ...
0
votes
1answer
67 views

Convert Mouse Coords into Isometric Tile ID

Using GameMaker Language, I'm basing off their Adavnced Examples. How can i convert the current mouse position into a tile position? The mouse coordinates are 0,0 from top-left This is the function ...
0
votes
1answer
29 views

How does this point2LineDist() method works?

I was browsing Wolf3D JS port and bump into that method : /** * @description calculates distance between a point (x, y) and a line. * @memberOf Wolf.Math * @param {number} x X coord of point * ...
0
votes
1answer
42 views

Which three points to use to calculate a frustum plane?

So I have a view frustum I'm going to be using for frustum culling. I have a method that finds the cross-product of three points but since each side of the frustum has four corners I don't know which ...
0
votes
2answers
67 views

Why does Mathf.Log(x) return infinity in this case?

I'm facing an unexpected behavior due to computational limits, I guess. I have a function Log(x) which, for some high value in the Fibonacci series n 187 = 5.38·10^38 returns Infinity. Is there a ...
0
votes
1answer
51 views

Frustum culling only working at certain angles

So how I'm doing this is a little sketchy but I plan on changing it to either AABBs or spheres once I get it working. So the problem I'm having right now is that the frustum culling I've implemented ...
1
vote
1answer
82 views

How to clamp a direction vector within a direction pyramid?

In 2D you can specific an angle range such as [-45 to +45] and clamp a 2D direction vector within that angle range. I want to have something similar for 3D. I want to specify the allowed directional ...
0
votes
3answers
196 views

How to calculate the closing speed of two objects

I have the 2D positions and 2D velocity vectors of two objects. How do I calculate the closing velocity ? I want to get the closing speed. Think of one jet tracks another jet with radar and you want ...
0
votes
0answers
49 views

How to get correct quaternion value from real world to screen?

I'm writing an application (not a game per se, but close enough) where we use attitude sensors (an IMU) in the real world to affect the orientation of an object in the application's 3D space (OpenGL). ...
0
votes
2answers
33 views

Object has its heading stored as Euler angles. After it makes a turn, how do I calculate the new angles?

Assume said object is an aircraft. I store three angles (in degrees) that describe where it's headed: yaw, pitch and roll - in that order. Let's say the plane is flying vertically, upwards. The angles ...
3
votes
3answers
140 views

Increasing chance of good loot after multiple tries

I'm looking for a way to make chances of getting better loot increase the more you've looted. I do not want it to be possible to get a rare item the first 5 times and not being able to get an epic ...
0
votes
2answers
45 views

Detecting position within a circle

I need to detect the position of a knob on a touchpad. I need to detect if it is in particular areas and if so, which one. The sections, of course, being the colored parts. I know that the black ...
1
vote
2answers
101 views

Calculate Position on Tile Map by single Index

I stumble about a Math Problem for calculating a Position on a dynamic tile-map. So i got a List of Tile Entities. Every Tile got his one unique Index Value and i have to set the parameters for Map ...
0
votes
3answers
47 views

Velocity Relative To A Vector

So I have a velocity vector b in world space and I have a "pointing" vector a in world space. I need to know how to make the velocity vector to be relative to the "pointing" vector. Better explanation ...
1
vote
1answer
52 views

How to smooth hand drawn lines?

So I am using Kinect with Unity. With the Kinect, we detect a hand gesture and when it is active we draw a line on the screen that follows where ever the hand is going. Every update the location is ...
0
votes
1answer
50 views

Getting vector relative to other vector in rotating object

So I have a rotating object a. It is rotating at non-constant speed around it's local x axis. It is parented to object b. When the object a rotates, it's local x axis stays facing the same direction ...
2
votes
2answers
72 views

Calculate matrix transformation components separately

It is possible to calculate the translation, rotation and scale that were used to build a matrix? I mean if I have a matrix M can I calculate the rotation, scale, and translation it represents? Of ...
0
votes
1answer
53 views

Normal to an edge of a polygon, from a point inside the polygon

Suppose that I have a closed boundary that is represented by n points. Using these n points I construct a polygon with n sides. I have a point P(x,y) that lays inside the polygon. I want to draw the ...
0
votes
1answer
60 views

How to calculate acceleration and deceleration

I have a car with speed x, and can accelerate at a rate of 0.5 m/s^2, and can decelerate at a rate of -0.1 m/s^2. Maximum speed is 20 m/s. To accelerate the car speed, at each frame I need to do: ...
1
vote
1answer
77 views

How to calculate distance of travel needed get achieve speed x?

I have a boat traveling at 20 meters/second approaching destination x. Destination x has a range radius of 10 meters. What I would like to do is make sure by the time the boat arrives within 10 meters ...
3
votes
0answers
76 views

Filling Closed Shapes

Game Engine : Unity 5.1 Developing on Windows 7 Hello, I am using Vectrosity to draw some some shapes on screen run time. I also need to fill these shapes and none of them are really trivial shapes. ...
11
votes
3answers
4k views

Attack vs Defence and who is the winner? [closed]

I am in the process of creating a new simple game in mobile and I've spent several days on the following part. For simplicity, let's say that I have two fighters. The only attribute of them is ...
0
votes
0answers
31 views

How to find visible planes in a world of boxes

I have a world where each object is a box: Each box has position x, y=0, z, dimensions width, height, depth. The boxes are never rotated. Each box is composed of 5 planes (left, right, front, back ...
1
vote
1answer
78 views

2D sunrise in Unity

I see a lot of guides on how to create sunrise in 3D space, but I can't find much information on how to do it in 2D. In 3D, you rotate a lightsource around itself, but in 2D, I need to move the object ...
-1
votes
1answer
97 views

C++: from LWJGL to C++ with OpenGL

I've been trying my best on porting my 3D game from Java to C++, but to no avail. I use only LWJGL with OpenGL but I cannot find any other library in C++ that supports as much as LWJGL does for Java. ...