Stack Exchange Network

Stack Exchange network consists of 174 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Questions tagged [mathematics]

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

3
votes
1answer
86 views

Find ID from Spiral x, y positions. Hard programming formula

I have a formula, which gets coordinates from user_id (see below). I give User_id, and I get back coordinates. But now I need to get User_id from coordinates. For example: ...
1
vote
1answer
545 views

Unity aircraft physics

I want to make a simple aircraft controller, what looks like little realistic in unity. I watch some video from airplane physics. and make a simple script in unity, but if I start, my plane cant move ...
2
votes
1answer
74 views

Calculating the difference between two numbers using exponential growth

I think this is a very basic game programming question, but I am bad with math and new to programming & game programming so I'm looking for some advice. I'm making a 2D sprite game for iOS. Every ...
0
votes
1answer
26 views

lerp vector2 to target vector2 at constant rate

I am struggling to figure out how to lerp one vector2 to a target vector2 at a constant rate. I can do it as a percentage of the total x, y distance like so: ...
1
vote
1answer
27 views

How can I calculate the new vector of an object trying to push into (move along) the ground?

Say I have a sphere (planet). If I have object on the surface, I want to limit movement so that it can only travel in directions along or above the surface. Imagine a coin on a table. If I were to ...
1
vote
1answer
62 views

How to smooth rotations?

I have a semi-regularly (15fps to 60fps) sampled source of position and orientation to which I am using dead reckoning to fill in gaps. However, I would like to smooth it further to eliminate any ...
3
votes
1answer
632 views

What does a linear transformation preserve?

They say an affine transformation preserves points, lines, parallel lines etc. I can see this if I think in terms of translation [Is there any other affine transformation you can give as an example, ...
1
vote
1answer
404 views

How can I move a vehicle using speed and steering angle?

I want to drive a vehicle in x and y coordinate area with range from (0,0) to (6000,5000). I am using Visual Components (using Python API). On input I have speed data and steering angle of wheels ...
0
votes
2answers
125 views

Armor damage reduction system?

So I want to develop a Dota2-like armor system where damage reduction never reaches 100%. Armor values be like: ...
0
votes
1answer
57 views

Generate random number biased to an input value

I've got enemies with a difficulty rating from 0 to 1. I want to generate a random reward that tends to increase as the difficulty rating rises, but still be possible to have a value anywhere in the ...
1
vote
0answers
220 views

Has there been any research done on ideal values for loot drop tables?

I doubt many people want to grind for an item that has a 0.00001% chance to drop from a boss that takes 30 minutes to kill. I'd imagine there are certain factors that play into how rare an item should ...
1
vote
1answer
52 views

Prioritizing prefabs in array for procedural generation

I am trying to create procedural space background with a bunch of sprites of nebulas and stars. I have made few prefabs with different types of sprites attached to them. I have created an array ...
0
votes
0answers
46 views

Getting to know if a truck ahead of car

I'm checking if a car is passing through a truck and check if passing on its right or its left. that works, but when car stops, and the truck passes, that condition is also valid, I want to limit it, ...
1
vote
1answer
69 views

Get / Calculate edges of a 3D object - C #

I need to get all vertices in the edge position of a determinate object 3D (in this case a path). See the image: My question is, how can I get only the edges vertices, like the image?
1
vote
1answer
49 views

Spherical harmonics lightprobe problem

I am trying to add spherical harmonics based ambient lighting to my game but have run into some problems and while trying to solve this I have reduced the test scene to the following very basic ...
0
votes
1answer
70 views

How to randomly calculate the necessary velocity changes to reach a x,y,z target?

I am working on creating a mini vector graphics ping pong table, as described in this previous post: Trying to use 3D vectors for a 2D ping pong game Currently, the stage I am at, I am trying to make ...
6
votes
1answer
173 views

How to keep a cubic bezier curve symmetric while moving points

I have created a cubic bezier curve using the Unity editor. How can I preserve the bezier curve symmetry when moving the end points or control points/anchor points? Please see my code below and the ...
0
votes
1answer
86 views

Intuitively, why is 3.5 the average (mean) roll of a six-sided die?

Every page I could find on the web that answers this question explains it with Expected Value statistic probability math. $$(1 * \frac 16) + (2 * \frac 16) + (3 * \frac16) + (4 * \frac16) + (5 * \...
2
votes
0answers
25 views

Defining a coordinate system for player residing in another coordinate system

I'm making a game and I wanted to simplify some code by taking advantage of linear algebra. I'm a little stuck. Let's say the player (green triangle) resides in a coordinate system where the x-axis ...
0
votes
1answer
31 views

Get intersecting point of Arc, X distance from centre (Unity)

I'm no mathmetician so forgive my wording when I ask this, there is no doubt an answer somewhere but I dont even know what to search for. I want to find the intersection point (B) as a Vector2 on a ...
0
votes
2answers
144 views

Idle/Clicker games, supporting numbers many factors bigger than trillions in C# using Unity [duplicate]

Apologies for sloppy work and probably a poor grasp of fundamentals. I have a (likely primitive) way to convert the ever increasing number values of my enemy hp into a string format to display in ...
5
votes
4answers
3k views

Browser RPG fight calculation formula

I am making a simple browser rpg game, similar to battleknight. To keep the game simple, I have just Strength, Constitution, and Luck. But as luck is random based, I'm struggling with fight ...
1
vote
1answer
64 views

Fill closed object with water - maintaining volume

I'm showing the problem in 2D, but basically given a volume V (can be approximate), where should the center point of an upwards facing plane P be for any given rotation of the object? I'm not doing a ...
0
votes
0answers
21 views

Approaching behavior with acceleration and unlimited velocity

I'm encountering a difficult programming/math/geometry problem. I think it's best to ask here, but I could be wrong, if so please let me know where you think it might be better suited. I'd have a ...
0
votes
1answer
88 views

EnemyAI rotating on Y-axis in opposite direction

After a battle flag has gone off and the player has entered an enemy's battle zone I want to keep track of the player when it moves and make sure the enemy's Z-axis is always pointing towards the ...
0
votes
1answer
54 views

How to Calculate Caridnal Direction from Unit Vector

I have unit Vector of acceleration in local space of object. Now I want to calculate Cardinal Direction from (North, East, South, West). So Far I tried to: ...
0
votes
1answer
19 views

C4d or 3DS-like matrix rotations

I have a rotation 4x4 matrix to generate a model matrix, but I would like to be able to control it like cinema4D or 3ds Max with three separate angles that are always perpendicular to each other, and ...
4
votes
0answers
135 views

How to draw a Voronoi Splitscreen view in GMS, where each player's screen area is a polygon shape?

I'm trying to implement the Voronoi Splitscreen effect that Squirrel Eiserloh described at GDC 2016, and I'm having trouble figuring out how to 'clip' the rendered scene for one player along a ...
1
vote
1answer
115 views

Calculating the geometry of a thick 3-way miter joint

Following a very helpful post on another forum I've found a simple algorithm that takes an array of 2D vectors and creates a triangle strip. I've modified the source code for my purposes. I haven't ...
0
votes
1answer
199 views

How to calculate acceleration distance(frictionless, massless)

Object A is moving via. 2D rigidbody by velocity V and in script is defined breaking power P. Every frame of breaking (P * Time.deltaTime) is subtracted from velocity V (in other words, ignoring mass)....
0
votes
1answer
65 views

change random number into specific range using resolution

I am having a simple mathematical problem that i would like to scale a randomly created decimal points using numpy , then apply a formula to align this decimal ...
0
votes
1answer
42 views

Calculate corner rotation to fit between 2 waypoints

I'm currently working on a system where I create a linear path by spawning waypoints, but i'm struggling to figure out how to compute the rotation needed to render the corner waypoints correctly. if ...
1
vote
4answers
703 views

How can I spawn items based on probabilities?

I'm working on a game where I want to choose which object to spawn based on probabilities. Assuming the decision to spawn the object has been done by some other process, I'd like the object with the ...
-1
votes
1answer
48 views

What are the meanings of theta and gamma in this equation?

I'm having a bit of trouble understanding the notation from this paper: http://graphics.cs.aueb.gr/graphics/docs/papers/GraphiCon09_PapadopoulosPapaioannou.pdf ...
0
votes
1answer
38 views

Moving a point on a rotating sprite

I've been trying to get sprites to stay on a set point on another rotating sprite. At the moment, it's very inaccurate, the original position is wrong, and when the rotation is applied the sprite ...
3
votes
1answer
287 views

representing transforms without a world/global reference frame

Background: I'm trying to make a segmented/portal-based game engine that supports impossible (non-euclidean?) geometry. By segmented/portal-based I mean the world is divided into segments which are ...
2
votes
1answer
494 views

How to rotate directional billboard particle sprites toward the direction the particle is moving

Behavior: With the following texture I get a weird behavior when I try to rotate my particles in the direction they are moving. Essentially, the quad seems to rotate, but just barely so that when ...
0
votes
0answers
43 views

Converting 3D Points into 2D

I have a simple problem, just converting 3D points into 2D image coordinate, the image center should be 0,0 to -1,1 I have done the following equations with the help of @iedoc but I still don't get ...
1
vote
1answer
93 views

What is the meaning of this line algorithm?

I have been looking at codes of several open source 2d games and I have found this function. ...
0
votes
2answers
61 views

Check whether object is looking in between a minimum and maximum angle in 3d Space

What I want to accomplish is to check whether an object is looking in between a minimum and maximum angle in 3D space for example if a Helicopter is looking to the right... it would have to check ...
1
vote
2answers
59 views

Up / down powerbar computation at server side

I aplolgize if my question is unclear, because I don't know how to formulate the problem. I have a player that can do damage with a weapon. The weapon has a min and max damage. Holding the space bar ...
0
votes
1answer
153 views

Determining if a point is perpendicular to a line

I am trying to walk a line that is intersecting a mesh, and given the point on the line I need to see what vertices may be perpendicular to it. My initial idea was to attempt a dot product between the ...
0
votes
0answers
17 views

How to calculate Camera “correct” position and distance to Frame all my Scene? [duplicate]

Consider I have N dynamic points on my Scene, I would like to "frame" all them, with my Camera. How can i calculate (at runtime) Vector3 Position to correctly frame all my scene ? This is my idea: ...
4
votes
1answer
537 views

Unity - moving an object around a radius

I'm trying to move a 2D object around the mouse position, However, i want to constrain the object from rotating unnaturally around itself, i want it to basically rotate around a radius, similar to how ...
0
votes
2answers
80 views

Pushing an object left and right (gravitation towards center of a circle)

So this is the problem: I have an object pulled towards the center of a circle and I am unable to figure out how to move the object left and right depending on its rotation around the circle. I ...
-1
votes
1answer
202 views

How can I calculate normals using a vertex and index buffer?

Is it possible to calculate normals using the positions in a vertex buffer and index buffer? Would someone show pseudocode for the algorithm?
0
votes
1answer
53 views

Restore object right vector to horizontal position using quaternions

I'm fairly new in gamedev mathematics and i have a problem i cannot solve on my own. I'm working on L-System tree generation engine and i'm having serious difficulities while trying to work out ...
0
votes
0answers
208 views

3D Coulomb Friction - Use Collision Impulse To Calculate Friction Force?

I've been using this document to learn how to implement a very basic physics engine. The section on Coulomb Friction on page 55-56 (marked as pages 43-44) confuses me. It observes that the friction ...
0
votes
1answer
121 views

Random tile-based floor plan generation with enclosed rooms

I've been working on a project for a while which takes a grid of n*n tiles (starting at n=16 and with n increasing by 4 every so often for new floors), and fills it with rooms of random rectangular ...
0
votes
2answers
218 views

2d tile map render rotation math?

I am working on a personal project and am trying to make a 2d tile map render that needs to handle rotation. I am using raylib to handle the drawing stuff onto the screen and am using this function ...