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)

4
votes
2answers
57 views

Evenly distributed checkpoints in a procedurally generated world?

Got a procedurally generated world. It's succinctly described as an undirected acyclic graph where vertices are junctions and edges weights/length note the amount of time/effort guesstimated to be ...
0
votes
1answer
26 views

What are suitable and latest ranking system for racing games? [on hold]

I have been developing a game for iOS. I am not able to figure out a ranking system for the game. Can someone suggest most frequently used and best ranking systems.There will be a user who will be ...
0
votes
0answers
8 views

get tetrahedron centroid velocity if vertex velocities known

If i have a tetrahedron and i know the velocities of the 4 vertices, how can I find the velocity of the Centroid? I know how to get the result if i know the velocity of the Centroid (i can use ...
0
votes
0answers
19 views

Determine local “roll” from matrix

I'm allowing my player to maneuver freely in three dimensions. The world is very cubical, so it is useful to know internally (to help hint controls) which ground plane they're closest to paralleling. ...
9
votes
3answers
150 views

How do I correctly project a point behind the camera?

I am making a 3D game in which I put an exclamation marker above points of interest. In order to find out where in the 2D screen should I put my marker, I am manually projecting the 3D point where ...
0
votes
0answers
25 views

LibGDX make an object rotate around something

I need to rotate and object, which should be a circle made up with a ShaderRender, around a specified point. In LibGDX there is a method or something which allow me to do this? If it doesn't exist how ...
0
votes
0answers
15 views

Libgdx draw random wavy lines (similar to sinx)

I am looking for drawing a wavy road. It must be random and I have to add an hitbox on its bound, how can I do it? I want drawing red objects Example :
0
votes
0answers
14 views

Screen coordinates to letterboxed view

So I have letter boxing working properly (it's not really important but I'll post that bit of code too), but I'm trying to figure out the point/vector arithmetic for translating (projecting) screen ...
0
votes
1answer
27 views

How to make a joystick follow the touch around a starting point using atan2?

I would like to move a joystick, and be able to go beyond the limit of the circle, and the joystick should follow the angle from the touch (the touch is moving), but it should stay on the circle. It ...
0
votes
1answer
36 views

Given a constant rotation and target point, find position so that point will be in camera center

Given a fixed rotation and a target "center" point, how to I find the position the camera should be in so that that point is the center? LookAt changes the rotation keeping the position constant. ...
0
votes
3answers
58 views

Non equi-probable random function

I was trying to find or make a function which is not equi-probable, meaning some values are less probable than others. Apparently what I want has something to deal with ...
1
vote
0answers
65 views

Transformed Vertices have wrong Z Axis

For quite some time I've been working on my open 3D game engine, to learn how this stuff works. You can see the full codebase relating to my problem here on GitHub. I'm using an OpenGL 3.3 Core ...
0
votes
0answers
42 views

Libgdx trying to get reflection of ball with plane in 3D space

I just cannot seem to get the right reflection result. Have tried reordering the operations but none seem to work. Hoping someone might tell me what I am doing wrong. Trying to accomplish the formula ...
-1
votes
1answer
81 views

Cannot find bug in frustum culling code

I've written some code for frustum culling, but for some reason, it is not working, and i can't find the bug in it... Maybe a bug in the math, somewhere? So, i'm asking you if anyone could check these ...
1
vote
2answers
86 views

Circle-Circle collision resolution

This seems easy but I can't figure it out, when I have one circle(c1) collide with another(c2) I give the c2 circle the heading of c1 and send the c1 circle on the normal vector to the heading (the ...
0
votes
1answer
69 views

Quaternion Slerp and Lerp implementation (with overshoot)

I am working with Unity (C#) and was looking for an implementation of Slerp and possibly Lerp that allow overshoot (progress not strictly limited to 0..1 range). I want to do some tweening animation ...
-3
votes
2answers
109 views

How to find damage per second using Average Damage, Accuracy and Fire Rate Per Second? [closed]

I was wondering if anyone could help me establish a DPS equation using the variables 'Average Damage', 'Accuracy (%)', and 'Fire Rate Per Second'. Here is my table: Note: These numbers are ...
1
vote
2answers
59 views

How do I wrap an image around a sphere?

Ideally I'd like a reference of the math involved, so I can start breaking down the problem. The simplest thing I can deduce about this problem is that the part of the sphere that the user is ...
1
vote
1answer
61 views

Determine which face of a cube is facing the camera

I have a Cube with a unique color for each face. I made a script where I can swipe and rotate the Cube in increments of 90 degrees in each direction. what's the best way to determine which face of a ...
0
votes
0answers
18 views

C# Pathfinding in 2d array (procedural generation) [duplicate]

I have the following random example data in a 2d array 030 300 030 003 The 3 represents a room, the 0 represents its an empty block and 1 represents a corridor. Now i want for example the following ...
0
votes
3answers
89 views

2D Box Collision Trouble

Hello I am trying to handle some simple box collision (axis-aligned) in my top-down 2d game, but running into a problem. My game is running at a fixed time step, and checks for player-wall collision ...
0
votes
1answer
143 views

Rotate Object Towards Direction in 2D

For my RTS game's physics engine, I'm trying to find out a clever way to make a unit face the direction it's moving in. Given a Vector2d direction of movement (its normalized velocity), how can I ...
0
votes
2answers
79 views

(Efficiently) Generate Unique Random Numbers [duplicate]

Sorry my terminology is somewhat limited so I'll have to use more words to explain what I mean. In games that require critical hits, I've heard it's not good to generate a random number but instead ...
1
vote
3answers
104 views

Detect if two objects are going to crash

i am working on a car game where i am to create an AI, in the game there are other cars and a few objects moving around that i do not want to crash with, i have the speed, position and direction of ...
1
vote
3answers
110 views

Calculate intersect point / aim point

I'm working on a simple game, and I need to calculate the position to aim. Since my math days are a bit behind me, I put together a simple example to illustrate: So given that I know the position ...
1
vote
1answer
174 views

How do I reverse this function?

I'm working on an isometric tile rendering engine and I need to reverse a function I used to translate the Cartesian coordinates into isometric coordinates. I've already written a function for this, ...
0
votes
1answer
90 views

How to use atan2 to get the correct angle? (inside or outside angle) [duplicate]

I would like to rotate an object (white rectangle) towards another object (black rectangle). EDIT: the white rectangle (at the top) has a camera. I finally rotated the camera by 180 around the "y" ...
0
votes
0answers
21 views

2D viewport matrix World to Local coordinates

I would like to use a Matrix but it causes (or I think it does) problems with accuracy. Clearly classic float matrix causes jaggy movement/accuracy issues. The reason is that my objects have real ...
2
votes
0answers
68 views

Rotating a 3rd person camera toward a target

I have a 3rd person camera that doesn't look directly at the player but somewhere in front of him. When the user enter shooting mode, I want the camera to turn around the player to face the target. ...
2
votes
1answer
47 views

Mapping Coplanar Vertices in 3D space on to a 2D Plane

Say I have a plane specified by a normal vector and point on the plane. I want to specify a 2-D co-ordinate system that lies 'across' the plane, and then use that to find the 2-dimensional distance ...
-1
votes
1answer
110 views

Tile map optimization algorithm

I've read this artical on tilemap optimization https://www.scirra.com/blog/ashley/3/tech-blog-tilemap-tidbits and wondering what algorithm is used to achieve something like this. I'm wondering ...
1
vote
1answer
56 views

How to implement this collision detection function?

I would like to know how to implement this collision detection function, but I'm not even sure what it's called. The input shapes are 2D convex polygons, with an optional "rounding radius": imagine ...
2
votes
2answers
101 views

How to select random points within grid meeting min/max distance requirements from each other?

I have a 2D grid map that is relatively large. I'd like to pick some semi-random points all over it (say N points). The rule I want to ensure here, though, is that any selected points are at least M ...
0
votes
0answers
7 views

Find fastest rotation left or right to face an object [duplicate]

im working on a competition where i am creating an AI for a game that the host has published and made for this event, i have two commands for turning my car and that is left and right, spinning on the ...
0
votes
2answers
80 views

Fast Ray Sphere collision code

I am looking at here and while it's well organized a lot of links are broken: http://www.realtimerendering.com/intersections.html I am trying to find fast code that will give me the hit point and the ...
1
vote
1answer
211 views

Estimate the time it takes for an object to travel from point A to point B

I have an object with vec2 position, velocity, and destination with 2 variables maxspeed and acceleration. In each step, its position is calculated as follows: vec2 desiredVel = destination - ...
0
votes
2answers
71 views

Need some help with math steering behavior stopping on destination point

I have implemented a movement system based on steering behaviors: http://gamedevelopment.tutsplus.com/series/understanding-steering-behaviors--gamedev-12732 where each object has vec2 position, ...
0
votes
1answer
58 views

Simulate popularity

I'm working on a music game. It has genres like pop and rock. Different centuries have different music popularities. (Influences the sales) I thought about building an object like this: var rock = { ...
3
votes
5answers
247 views

Is there a quick way to determine if a vector is in a quadrant?

I am wondering if there is a quick easy way to determine if a given vector is in a specified quadrant. In the below image, I've define the ranges of the blue quadrants. For example, if I am given ...
0
votes
1answer
68 views

How to invert a damage formula?

I have created simple damage formula based on source percent, which return fixed percent of damage. DAMAGE_PERCENT = Exp(Log(100) * (1 - (100 - SOURCE_PERCENT) / 150) Here is the result: ...
1
vote
2answers
54 views

atan2 : inversed result? (angle 180 is on the right side, angle 0 on the left side)

the result of the angle between my touch and the middle,bottom of the screen gives me 180 when the touch is on the right side of the screen, and 0 when it is on the left. I don't understand why... ...
0
votes
1answer
48 views

How the values of h and the perpendicular had computed

How the values of h and the perpendicular had computed or taken in this answer of a previous question??? please clarify it How can I make a spline out of three points that define circular arc?
0
votes
1answer
34 views

Inline-Building a World (SRT) Matrix

Currently, to construct a world matrix, I have the following code: return FromScale(scale) * rotation.RotMatrix * FromTranslation(translation); However, this is constructing three matrices, and ...
0
votes
2answers
120 views

How to move dashes towards target?

Would you know how to create a dash line that moves towards the direction of the target, and if it collides with a wall, goes to the opposite angle? I have seen atan2 but I am not sure what it does, ...
0
votes
0answers
70 views

How to get a position from a radial distance and angles?

I have a radius and the 2 angles for northSouth and eastWest rotations in degrees. I need a Spherical position or a cartesian position (I have code translate one to the other) Where a position is ...
1
vote
0answers
46 views

Find the largest empty space inside a cube populated with a point cloud?

Lets say we have a set of points (x, y, z) where we know 0 < x < 1 (same for y and z). Now that 3d space is populated with monsters, players or what not. The points represent their location. We ...
4
votes
3answers
273 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
1k 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
52 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
65 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 ...