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
0answers
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....
1
vote
0answers
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 ...
3
votes
1answer
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 ...
28
votes
8answers
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 ...
0
votes
0answers
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 ...
1
vote
2answers
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 ...
0
votes
0answers
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 ...
1
vote
1answer
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 ...
1
vote
0answers
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 ...
0
votes
0answers
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 ...
5
votes
2answers
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 ...
1
vote
1answer
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) ...
-3
votes
0answers
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.
1
vote
1answer
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 ...
1
vote
2answers
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 ...
1
vote
2answers
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 ...
1
vote
0answers
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 ...
3
votes
1answer
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 ...
1
vote
1answer
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. ...
2
votes
1answer
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. ...
2
votes
0answers
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 :...
1
vote
1answer
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 ...
0
votes
0answers
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 ...
2
votes
1answer
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 ...
0
votes
0answers
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 ...
1
vote
0answers
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 (...
1
vote
0answers
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 ...
1
vote
1answer
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, ...
3
votes
1answer
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 ...
1
vote
1answer
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 (...
-2
votes
1answer
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 ...
0
votes
1answer
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 ...
0
votes
0answers
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 ...
1
vote
2answers
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 ...
0
votes
1answer
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 +...
0
votes
1answer
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 ...
1
vote
1answer
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. ...
0
votes
0answers
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 ...
1
vote
2answers
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 ...
0
votes
1answer
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 ...
1
vote
1answer
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 ...
1
vote
0answers
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....
1
vote
1answer
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 ...
1
vote
1answer
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 ...
1
vote
1answer
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://...
1
vote
1answer
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 ...
0
votes
1answer
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:...
0
votes
2answers
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 ...
3
votes
1answer
76 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 ...
4
votes
2answers
176 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 number,...