# Tagged Questions

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

10 views

### Terrain Collision problem

I'm trying to implement terrain collision for my height map terrain, and I'm following this. The tutorial is for java but I'm using C++, though the principles are the same so it shouldn't be a problem....
33 views

### My orbit code produces the wrong results

I have a GameObject called "Sun" in the sky. A game object called "GameManager" keeps track of time in the game, it is responsible for updating the hours and days. For my sun I do something like this ...
73 views

### Earth-like acceleration seems slow

I wanted to make a kind of "fill the box" style game where you hold down to increase size of a ball that falls when you let go, end goal being covering a percentage of the screen. Anyway, I wanted to ...
4k views

### How can I prevent small numerical advantages from dominating the balance of an encounter?

I've been tinkering for some time with a game and I'm having a fair amount of trouble with something: I have two characters, each of whom have attributes (about ten) in a range (between 1 and 20). I ...
50 views

### how to get two or more vector3f to follow each other [closed]

How do i get two or more vector3f points to follow each other with a distance? i am working with particles in 3d and already have the 3d rendering of the particles down. I'm going for an effect a lot ...
46 views

### Calculate length of isometric line

In my isometric game the user can draw a line of arbitrary length, and I need to calculate the "unprojected length" of the same line. Users can only draw lines in 6 directions (4 isometric directions ...
36 views

### Battle equation [closed]

I am trying to code my own game and I am stuck at battle equation. I will try to explain what I am trying to do as much as possible. There are two teams in the battle- T1 and T2. Troops power T1 ...
28 views

### How to map control key to a specific angle or orientation?

At the moment, I basically have built out a large hash table of various angles and what direction they map to, if the user would press right, up, down, left. This is needed, in my case, as I have a ...
28 views

### Mathematics help. Preliminary grid checking assistance. (Supercover Z)

Problem outline: A ray passes through a gridcell. The gridcell's max z's must be compared to the ray segment's min z. This is the preliminary check, so it must be quick. 2 values must be obtained, the ...
16 views

### Slide along Surface

I'm very bad at Math and trigonometric functions (And I dunno if this questions fits here) I have a surface normal as a direction vector.I want my character slide along the surface, if the angle of ...
121 views

### How to orient a hexagonal tile on a geodesic sphere (Goldberg polyhedron)?

I've recently ported the hexasphere implementation by Rob Scanlon at https://github.com/arscan/hexasphere.js to objective-c for use in a project I'm exploring. As a port, it works very well, and I ...
61 views

### Why does this whirlpool simulation not work?

I am trying to create a simple whirlpool simulation, where particles are constantly compelled to move towards a point in a whirlpool like fashion. To do this I do the following (in sudo code) ...
16 views

### Mouse coordinates to Isometric world coordinates [duplicate]

How can i convert mouse position to isometric world coordinates? I was searching answer on internet, but their solution did not work.
55 views

### Quaternion based camera pitch freaking out, and Z-axis drift

This is the code I use to control my (first person) camera's movement and rotation. Translation successfully keeps orientation in mind, so that up and left and such are always in the expected ...
45 views

### Rotate directly towards a target at a constant speed

I've written a program (see on JS Fiddle) that rotates my player towards the mouse cursor at a constant speed. I've computed the angle to the point using the Math.atan2 function, but when incrementing ...
62 views

### experience/level growth system formula based on a plot chart, what kind of equation suits this one?

Hi I am trying to build a experience/level growth system based on the following plot chart, however I can't think of a proper formula or equation to this chart. Can anyone lend me a hand, please? The ...
43 views

### Moving along the surface of a mesh?

I'm trying to replicate the movement in this game: https://www.youtube.com/watch?v=OcvD8BXars8 The players ship along with all other game elements move along the surface of a mesh. I've tried ...
49 views

### Point plotting with a line graph

Please see attached screenshot. Here's how it works. A is a slider that goes up and down, and the red line uses the centre point of the A slider to draw its start point. B is another slider, but ...
35 views

### How Matrix4 represents an object in space and matrix lore

I have been following some tutorial's on how Matrix maths works, with adding, dividing, scaling, etc, but I am struggling to understand how the 4x4 matrix represents an object's position in space. ...
26 views

### Check if a 3D mesh is a rectangular prism

I have a mesh post-processor in Unity that automatically a convex mesh collider to objects that need one (mostly all). Sometimes however there are objects that only need a box collider instead. ...
23 views

### What is the formula for the collision of two “stretched spheres”?

In Smash Bros Melee, hitboxes aren't perfect spheres or boxes. They are, instead, a shape that looks like a continuous line of consecutive spheres: I.e., the geometry can represented as: Hitbox :...
89 views

### Java Distance between two Vector positions never 0

I have a Player moving, but when the player reaching the destination it should stop. But problem is that distance never return 0. It starts printing this: 0.9672514210000003 End by this and then ...
22 views

### (3D) Parabola jump with given start and end

I have a start point and and endpoint given. I'd like to lerp the position from start to end via parabola i.e. over an arch. -(x-x0)(x-x1) won't work if one of the points isn't zero. Someone has a ...
93 views

### Translation Matrix not working properly

Hello, I get this result when i try to scale and then translate a vec4 in my shader. I created a mat4x4 class on my own and some functions wich return some matrices for me, everything works, but not ...
17 views

### Perlin simplex noise transformations

I am programming the simplex noise and I am a bit confusing about about the transformations between simplex and regular grid. I understand it this way: I start in simplex grid. Then I transform input ...
29 views

### Jumping on meshes in Babylon.js

So I want to make it possible for players to jump on objects (meshes) that are somewhat lower than the players camera. I have set the checkCollisions to true but i can't seem to jump on any objects (...
54 views

### How to fix my camera angle in ROBLOX?

I am trying to make my own camera in ROBLOX. Here's my problem, I am using an inverse function to make the camera look nice and smooth but it only works on the x axis in the positive side. Here's an ...
54 views

### Unity Vector3.Angle() direction

I have a space fighter AI. I need to determine how to pitch, yaw and roll the craft to aim at the target. My current solution: To obtain the Yaw angle to position the target above the fighter, ...
37 views

### Optimizing black and white matrix block drawing

Disclaimer: I am uncertain if this is the best place to post this question, so please advise me of how I can best find the answer if I am doing something wrong. I am asking this question because I am ...
42 views

### How to convert -1 to 1 coordinate back to screen coordinates?

Here is a question in which Questioner asks how to convert world coordinates to 1 to -1 coordinates like Opengl, I want to know how to do that in reverse, that given a coordinates between 1 and -1 (...
100 views

### How to determine a “Hit\miss” system?

I always try to fix my problems on my own, but i've reached a point where my mind is stuck so i trust myself in your hands, if you're willing to help and have the time. I'm starting to make a RPG ...
40 views

### How to normalize angles from points in java

Previous thread on projectile slopes What is the velocity of a translating projectile in 2D? What I'm trying to do Get the slope at a constant speed for both X & Y Coordinates though I don't ...
25 views

### Get relative angle to collision Unity

I want to get the angle between the rotation (euler Angles) of the camera (V1 : Vector3) and the collision point of my character, when it hits a wall, to determin, if it was left, right, or in front ...
82 views

### What is the velocity of a translating projectile in 2D?

What I'm trying to do. So I want to have a projectile that starts at point (x1, y1) and head in the direction of my mouse say point (x2, y2). To clarify I'm pretty sure it's a vector but I don't ...
34 views

### Ease out elastic function with equivalent start and end values?

I have an elastic ease out function, formula in code: float easeOutElastic(float t, float b, float c, float d) { float ts = (t/=d) * t; float tc = ts*t; return b+c*(33*tc*ts + -106*ts*ts +...
24 views

### How to find a point of taking into account the distortion of the projection

I can not find the material that will help me to implement the algorithm of coordinate transformation based on the distortion of the projection. I am creating a code recognition algorithm (similar ...
40 views

### Gravity wells that go with finger [duplicate]

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. ...
21 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 ...
91 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 ...
46 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 ...
104 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 ...
42 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 org.apache.commons.math3....
56 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 ...
73 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 ...
36 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 http://...
61 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 ...
33 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 this:...
38 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 ...