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
1answer
33 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
15 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
22 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
79 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
21 views

What's the best book to give you the math and physics background to make your own game engine? [closed]

I want to make my own game engine, but could use a refresher on math and physics. I already know some stuff (like how to multiply matrices, integrals, differential calculus etc.). I've narrowed my ...
0
votes
0answers
19 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 ...
1
vote
1answer
77 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
14 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 ...
0
votes
0answers
23 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
36 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
37 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, ...
1
vote
1answer
23 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
41 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
94 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
33 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
24 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 ...
0
votes
2answers
73 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
27 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
38 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
89 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
44 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
74 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
41 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
72 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
31 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
30 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
74 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
167 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,...
1
vote
2answers
58 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
461 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
197 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
50 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
74 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
39 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
18 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
131 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
880 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
96 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). ...
1
vote
1answer
80 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
50 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
101 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
296 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 ...