Questions tagged [mathematics]

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

Filter by
Sorted by
Tagged with
0
votes
0answers
24 views

Grappling hook force resolution

Our team is creating a 3rd person adventure platformer in Unreal 4.22. One of the mechanics is a grappling hook. Think less-so a 'pull-to-point' grappling hook (Widowmaker, Just cause etc.). However ...
0
votes
0answers
34 views

Convert Flat World Angle into Isometric Angle?

My game is isometric 30 degrees (think Diablo 2), I'm looking to convert the angle A1 from the player tile A to the destination tile B into the appropriate angle A2 in the isometric view. For the ...
-1
votes
0answers
89 views

How could I improve the power and damage formulas in my action rpg? [closed]

These are the formulas i came up for before i came to this website, the first one is for damage ...
0
votes
0answers
28 views

Concept design-pattern for industry simulation required

I am making a mobile game simulating industry. A brief high level description is below. A hub could be thought of as a base/city, within which there are rooms/buildings which determine what is ...
0
votes
1answer
86 views

Mana regeneration formula

Suppose my mana regeneration rate was calculated in this way: ManaRegenRate = 0.01 × (BaseManaRegen + ManaRegenMultiplier × Willpower) × TotalMana Where willpower is my attribute ranging from 0 to ...
2
votes
2answers
88 views

Catan Optimal Placement

Is it possible to calculate the best possible placements for settlements in Catan without using an ML algorithm? While it is trivial to simply add up the numbers surrounding the settlement (highest ...
0
votes
0answers
27 views

What is a good algorithm for generating a linear regression of positions in 3D space? (for getting the direction of a thrown object in VR)

I'm trying to get throwing to feel right in my VR game. I don't plan on actually using physics to do this; my idea is to accurately determine the lateral direction of the throw, then move the object ...
1
vote
3answers
172 views

WoW attack speed calculation

Reading up on attack speed calculations for World of Warcraft I noticed that the formula for attack speed is: Attack_speed = "current attack speed" / (("Percent increase or decrease" / 100) + 1 )...
0
votes
0answers
32 views

Combining rotation (using Quaternion* Quaternion) doesn't work as expected [duplicate]

I have fragment of code that has to rotate the camera to the direction where my cursor is as below: float yaw = mouseSensitivity.x * Input.GetAxis("Mouse X"); float pitch = mouseSensitivity.y * -...
0
votes
0answers
20 views

Calculate direction of object to intercept moving object between two points [duplicate]

Please have a look at this graphic: I need to calculate the direction of B in order to intercept Z between A1 and A2, if possible. Both, Z and B start at the same time. Can anyone help me with the ...
1
vote
2answers
60 views

Should calculations be done on the CPU or GPU?

I'm currently learning OpenGL and it's become obvious that I can do most calculations on the CPU or the GPU. For example, I can do something like lightColor * objectColor on the CPU, then send it to ...
1
vote
0answers
47 views

The Google Earth solution for panning in a 3D world

About a year ago I made a solution for panning and zooming in a 3D world (Three.js) using a formula provided by @DMGregory. Here is the post: How to panning camera on XZ axis with different angles ...
0
votes
2answers
24 views

Get Closest point between a Box 3D and a Point

I have a point A (x, y, z), and a Box: Center (x, y, z), Size (Width, Height) How to get the closest point in the box from the point A ? In Unity I can create a bound, and I can find the non-rotated ...
1
vote
3answers
50 views

How to find perpendicular line given a line?

I have two points that form 1 line. I want to find a point that creates a perpendicular line. Here is an image showing what I am looking for: How do I find the red point to form a perpendicular ...
0
votes
0answers
23 views

Camera rotation to match UVs of a point across different FOV

I'm looking for the formula needed to calculate the amount of camera rotation required to display a point at the same UVs across two cameras with different FOVs. I can't modify the projection matrix ...
1
vote
2answers
62 views

How can I find the offset rotation and position between two objects in 3D?

I have two objects in 3 dimensions, one of them (Child) is attached to the other one (Parent) using the offset between them (XYZ ...
4
votes
3answers
111 views

How to calculate the reachable space of the end effector in an IK chain?

I have an array of points in a 2d worldspace and I want to calculate which points are reachable by the end effector of a limb controlled with a CCDIK chain (with rotation limits applied). It's a limb ...
1
vote
0answers
26 views

How does displacement mapping generalize bump mapping?

This PDF discusses bump mapping, a special case of displacement mapping. A surface is represented as a function \$\overrightarrow{O}\left(u,\,v\right):\:\Bbb R^2\mapsto\Bbb R^3\$. In bump mapping, we ...
1
vote
1answer
26 views

Find the direction a Projectile should be fired from a Moving Object to hit another moving Object?

I am trying to do a simple AI Controller, which fires Missiles at the surrounding targets in the Scene. The AI Controller can fire projectiles when moving or stationary. The Targets are either ...
3
votes
1answer
52 views

How do I get an object to rotate in world space via RigidBody.AddTorque?

I'm getting really discouraged because I can't seem to figure how how to rotate my object via Rigidbody.AddTorque like it is on a figurative global turn table rather than a local turn table. Another ...
0
votes
0answers
24 views

Calculating stopping distance while turning

I need to calculate the movement of an object that is slowing down to approach its destination while turning. Calculating the linear stopping distance and deceleration is straightforward. However if ...
-2
votes
2answers
99 views

Converting a table into a formula / equation

I need help to figure out the formula / equation or at least the growth rate based on this table. All I can see is that the base stat is 12 as STAT2 = 2 x base and STAT3 = 5 x base.
1
vote
1answer
45 views

Camera Transition between 2 position / rotation, and follow a 3rd target

I have setup a transition of camera between 2 transform, here the result in video: https://youtu.be/rcwQ6KuEfMw I have the information of the 2 transform: - position (vector3) - rotation (Quaternion) ...
0
votes
0answers
22 views

Converting a multidimensional array to a distance field

I've been working (as so many others before me have) on a small Voxel-type game prototype. So far, i have a 3d array (16 by 16 by 255 elements) that contains block ids - and as of right now, 0 means "...
0
votes
0answers
25 views

Account for scale offset?

I have an odd situation where I know the position of an item on a mouse click and I know the panning state of a 2D camera pointing at it. So what I do is render an object at the point in which the ...
2
votes
1answer
50 views

Quick way to approximate a truncated gaussian distribution?

I'm doing some procgen stuff and I need a truncated gaussian distribution. Basically, I need a way to get the same thing as this: ...
2
votes
1answer
59 views

How to draw a string into a polygon? (Libgdx, Java)

I am working on a 2D grand strategy game (like Hearts of Iron from Paradox but as I said only 2D game) and I would like to render the area names on the map. I made the Polygons for each area. How can ...
1
vote
1answer
44 views

How to calculate more precisely the position of the pupil in function of the eye ball and a direction?

I have a game in which I have an eye in a head that should always move towards a piece of food (or another piece of food). The head is moved by the player. The food has a fixed position (for some ...
0
votes
0answers
22 views

Need help to find a way to make a image mapping

I need some help to find a way of creating a simple game in any language/software/technology. What I have to do is to map a png image in order to create a correct "path" for a player so he can make ...
1
vote
0answers
19 views

Can I slightly rotate a 2D vector (UV Edge) to more closely reflect the corresponding 3d vector?

I'm trying to get the difference between the 3D angle of two connected edges and their corresponding angle in 2D (mesh to UV space). I would like to slightly rotate the angle in 2D to closer match ...
0
votes
1answer
23 views

Clamp GameObject Into Isometric Camera Viewport

I'm using the next code to move an objecto into an isometric projection (30/45) ...
2
votes
1answer
75 views

Modeling complex requirements for populating loot/drop tables

I have a set of items and a data structure that describes where and how those items may be dropped. I'm looking to implement a roguelike/randomizer element to the game and want to include the special ...
0
votes
1answer
42 views

Mapping a Texture to a 2d Quadrilateral

I want to map a 2d picture onto an arbitrary 2d quadrilateral, for the purpose of particle system. To do that, I split the picture into two triangles, and then linearly interpolated u,v along the ...
0
votes
1answer
57 views

Calculation of distance while switching between two speeds

There are two speed values, that are used by moving object. After a while speed switching occurs from V1 to V2. I need the formula that can be used for calculation of current distance (at specified ...
0
votes
1answer
54 views

What´s wrong with my Frustum Culling implementation?

I´m struggling with a weird problem since hours. Ive implemented frustum culling with the help of online articles and a book. The problem is that the objects are not culled correctly. I´m using ...
0
votes
1answer
23 views

Find optimal placement for label/sticker on a simple polygon with holes

I'm working on a real-time archviz renderer and I need to place a label/sticker/decal on walls, which have openings. So one way to think about this is a simple (possibly concave) polygon with holes. ...
1
vote
1answer
118 views

Round to the nearest multiple of 0.75 in C#

How can I round a number to the nearest multiple of 0.75 in C# / Unity? The context is that I have a block and I want its position to be rounded at the nearest 0.75 multiple. For example: 0, 0.75, 1....
0
votes
1answer
35 views

Unity3d: Find a point on the line which has shortest distance from the third point

So, initially, I had points A and C. To get point B, I had to shoot a raycast down from ...
0
votes
1answer
29 views

Unity3D: Move the parent gameobject relative to the child

So, I have X and Y game objects. I have a vector Z = X - Y which is indicated by the green line. Also, I have a ...
3
votes
3answers
174 views

Improve velocity obstacle calculation algorithm/performance

My goal My goal is to calculate the (velocity) obstacle that is imposed by unit B onto unit A. So I want to calculate the velocities from the center of unit A (circle) that will lead to a collision ...
1
vote
2answers
118 views

How do I launch a ballistic projectile to hit a moving target, given: launch position & angle, target position & velocity?

This problem is in 3D space. My question is: How do you find the initial velocity of a projectile that flies under constant gravity, so that it hits a target moving with constant velocity, given the ...
2
votes
1answer
67 views

Triangular Metric

Given a point inside a unit equilateral triangle, how does one rotate it across the triangle perimeter? I.e. the triangle outline serving the same purpose as circle's circumference. That is actually a ...
2
votes
2answers
96 views

Make a bullet move towards the mouse position

Before you give me a link to another post look first, just in case. So I'm making a top down game where the person can shoot around, I want the bullets to move towards the mouse, I have tried this: <...
0
votes
1answer
47 views

Unity3d: Position a gameobject such that its forms a right angled triangle with other two gameobjects

How do I position C gameObject such that it forms a right angled triangle with A and B. I tried to use ...
2
votes
1answer
34 views

Raise/Lower Object Height Based on Distance, with Easing

I'm trying to make an indicator object appear higher up in the sky the farther away a player is, up to a certain distance. Basically, if the player is < 5 distance away, the object's height should ...
0
votes
1answer
41 views

Unity3d: Find which gameObject is in front

I have two gameObjects A and B. They are rotated at <...
3
votes
0answers
44 views

Force propagation through physic bodies constraints (as non-penetration)

First, some context I'm currently implementing a (well, tiny) game engine using a predictive approach. The idea is to compute when a state change will occur, and only update state at time of the ...
0
votes
1answer
87 views

How Can I Load Ads Particular Level?

How Can I Apply Ads Different Level?? I Create A 40 Level, Ex: Level1 complete then load ads Interstitial Level2 complete then load ads Interstitial Level3 complete then load ads Rewarded Level4 ...
0
votes
1answer
129 views

Unity3d: Get a direction vector parallel to plane

I need to send a raycast from my camera which is parallel to the plane (Ground) and in the same direction of its forward vector (Represented by the black color vector) I cant use world space ...
4
votes
1answer
77 views

Calculating damage with damage mitigation/amplification curve/function

Let's say instance A is attacking instance B for N damage. I want to calculate the ideally expected damage if those instances have damage mitigation/amplification depending on target's current HP. ...