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
2answers
185 views

How does lookAt matrix math work?

Can someone provide me an explanation of how the lookAt matrix works? ...
1
vote
1answer
426 views

intersection of primitive in a unit wrapping 3D space

is there people good enough for a math problem (for a shader)? I want to write an algorithm that would intersect primitives (triangles, squares, circle, sphere, cube, cylinder) inside a unit wrapping ...
2
votes
3answers
843 views

Why aren't regular quadratic and cubic splines used much in games?

After investigating a bit about splines and reading a bunch of docs, I have noticed regular quadratic and cubic splines are not used very much in games. Splines using quadratic/cubic Bézier curves, ...
1
vote
1answer
45 views

Dividing amount of exp between rank A and B into a curve?

In my game I have a rank system. You start at rank A, and then you can level from level 1 to level 10. When you reach level 10, you get promoted to rank B, and you go from level 1 to 10 again, and ...
0
votes
1answer
122 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 ...
3
votes
1answer
1k views

Converting Euler rotation angles from Z up to Y up (Max to OpenGL)

I'm working on pulling geometry and it's transformation from a 3DS Max exported FBX (Z-up) to an OpenGL model format (Y-up). The main problem is I intend to keep the transformations as Translation and ...
0
votes
0answers
29 views

Unity3d - Tile-based "Slippy" map rendered on a sphere (earth)

Scenario I'm creating a spherical version of a slippy map using osm tiles and my luck has been limited thus far. I'm starting to think my strategy has lead me astray and that I need to start from ...
1
vote
1answer
36 views

Snap joystick value to minimum magnitude when it falls below

I got a joystick displayed in the image below with range -1 to 1. Green area is 80% of the total circle and yellow area is 20%. I want to get corrected values for both areas. For example: If given ...
1
vote
1answer
81 views

Matrix math in cascade shadow mapping

I am implementing cascade shadow mapping algorithm and currently stuck with matrix transformations - my AABBs, when projected in light space are pointing in the direction opposite to the light: I was ...
0
votes
1answer
31 views

How do I calculate a matrix to render a mirror about a plane using GLM?

I've been trying to work out how to render a mirror for a while now, but a lot of resources I find either use very outdated tools I'm not familiar with, appear to be college slides referencing other ...
0
votes
1answer
74 views

Math formula for: the higher the stress, the higher the difficulty

My game has a stat called Stress, and the player has some missions to do. Each mission has a computed stat called Difficulty ...
8
votes
3answers
14k views

How do I find the circumcenter of a triangle in 3D?

I want to find the circumcenter of a triangle. Wolfram only shows how to find the circumcircle of a triangle in R2. How can I find the circumcenter of a triangle in R3?
0
votes
1answer
66 views

Speed after an angled collision?

I can calculate the speed when there is no angle, but I can't calculate the speed when it is angle. Physics paramaters: ...
1
vote
2answers
344 views

Rotating sprite 180 deg

I should say first, that I have the rotation down. Its just that I want my square to rotate exactly 180 degrees. Currently, it will rotate but it will rotate but by less each jump. So after several ...
0
votes
1answer
75 views

Calculating child world translation, rotation and scale

I'd like to know if it's possible to calculate a child's world translation, rotation and scale individually. I'm used to seeing devs resorting to matrix multiplication and then decomposition, like so: ...
-2
votes
1answer
96 views

What happens if first we scale a rotation matrix and then multiply it with an object?

This question has been bothering me lately. I know the correct order to scale, rotate and transform a matrix but the question I have is very different. What if we first scale our rotation matrix by ...
1
vote
2answers
594 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 ...
11
votes
5answers
2k views

Terracing mountain features

I'm looking to replicate a procedural terrain effect I found on a portfolio/blog site a few days ago. Quoting the site, the terracing was generated through, "multiplying [the final height] by some ...
0
votes
1answer
68 views

FBM alteration based on derivative and noise value

I'm still working on my procedural terrain generation and kind of sniffing ideas from Sean Murray (No Man's Sky programmer). So I watched this GDC17 presentation, but some things just don't make sense ...
0
votes
1answer
77 views

How to design a system that allows for custom equations of movement?

I'm developing a top-down shooter and I currently have a PhysicsSystem which operates on TransformComponents. Basically, it ...
0
votes
1answer
360 views

(Unity3D) Determine If Ray Intersects Given Rectangle

I'm building a city generator for my game and I want to ensure buildings are never placed in such a way that they overlap roads. Currently I have the system build the roads, then place buildings ...
0
votes
1answer
43 views

How do I predict where a player will be next in Forge/MCP?

I am trying to predict where a player will be next based on where they are now in Java. I have their XYZ position, their XYZ motion, but I don't have their speed. How can I predict where they will be ...
0
votes
1answer
25 views

Compass objective indicator points towards wrong direction

I have a compass that is pointing towards player forward direction. ...
0
votes
2answers
115 views

Quaternions distorting object in Metal

I've been trying to get rotations with quaternions to work for a while now, and I feel I am very close to it actually working but I just can't get it to work. I do not have a view matrix yet and am ...
1
vote
1answer
43 views

Find the smallest angle to turn between two angles in range 0..1

I have a function for approaching a value to a target by a certain amount: ...
0
votes
1answer
28 views

How to find Particle Position at Time with velocity and friction?

I have a Particle p. A particle consists of a start position p0,an age t, a velocity ...
0
votes
2answers
112 views

Finding rotation quaternion from orthonormal basis?

Given three 3D unit vectors \$a\$, \$b\$, \$c\$ such that: \$a \times b = c\$ \$b \times c = a\$ \$c \times a = b\$ (ie \$a, b, c\$ form an orthonormal basis) How do we calculate a unit ...
1
vote
1answer
78 views

What kind of math is used by this camera panning script?

I'm not fluent in English so I apologize in advance. I have found a source code in order to pan camera by touch - here it is: ...
1
vote
1answer
56 views

Isometric projection, calculate camera angle for specific tile height

I'm experimenting with different tile dimensions while rendering 3D assets for an isometric game (or dimetric to be exact). Everyone does a 2:1 ratio so the tiles in isometric view are 256wx128h, ...
9
votes
1answer
119 views

How to clip cut-off using different frustrum than that of original camera? How to cut plane by pyramid shape?

SOURCE : http://amd-dev.wpengine.netdna-cdn.com/wordpress/media/2012/10/Mitchell_LightShafts.pdf This process is part of creating light draft effect. And I am suggested to do the described process in ...
0
votes
0answers
22 views

Dynamic circular motion increases in energy

I am experimenting with designs for physics engines for which I use particles and fields like magnet fields. In magnet fields you have a thing called Lorentz force ...
5
votes
1answer
109 views

How are Spot It cards generated?

Spot It is a card game 55 cards. Each card has exactly 8 symbols on it (though the total number of different symbols used in the 55 card set is 57). For any two cards in the deck, they share exactly ...
0
votes
1answer
84 views

Cylindrical billboarding around an arbitrary axis in geometry shader

I found an answer on this site relating to this question already, but it doesn't seem applicable in the context of my project. Basically I'd like to create a method which fits this signature: ...
0
votes
1answer
68 views

Find those points lying on a circle from a ton of points

Given a 2d scene and 10,000 players with coordinates in the scene, I want to implement a function, the input is a circle with the center coords and its radius, the output is those players that lie on ...
2
votes
1answer
184 views

Godot - Offscreen Target Indicator

I have a crosshair image that will lock onto enemies that are visible in the camera and will stay on the edge of the screen when the enemy is offscreen. This works until you face more than 90º away ...
0
votes
0answers
70 views

What would be the effect of making Wealth a diminishing-returns variable?

I've been playing a bunch of Fallen London lately, and I find it interesting how they do "pyramid qualities": Achieving level X in something requires +X points.. 1 for level 1, 2 more for ...
0
votes
1answer
63 views

Knockback to zone on non-rectangular field

I have a playing field which is divided in 4 zones (as seen on the image below) The player (blue) is on the second zone while there are 2 enemies (red) on the third zone. When the player throws an ...
-1
votes
1answer
64 views

How to gradually interpolate smoothly between two yaw rotations in Minecraft MCP/Forge?

I am coding a custom client for Minecraft using MCP. (Please no hate, I'm not making a hacked client!) I have two variables currentYaw which is the current yaw ...
0
votes
1answer
51 views

How to compute an incremental movement: \$f(t+h)-f(t)\$ or \$f(t)-f(t-h)\$?

For the sake of getting precise position, I think I need you to clarify whether or not the tutorial calculation is incorrect and my calculation is correct. Assume we want to move an Actor up and down ...
0
votes
1answer
77 views

Could you explain how this GameObject rotating around another GameObject works?

I'm just learning Unity and I follow a tutorial for a simple game which I want to build up from. I'm already mostly done with the course and at the end a "boss enemy" gets implemented. Its ...
1
vote
2answers
114 views

Formula for stacking percentages to keep them from getting out of control

I have a game that has a mechanic, where a specific class can stack what are called "life stealing enchantments" to steal greater amounts of health from the enemy depending on the type of ...
1
vote
2answers
153 views

Getting Model View Matrix by hand

Right now I'm trying to calculate the model view matrix by hand... The App is 2D. I have something like this: ...
2
votes
2answers
154 views

How to predict where the soccer ball should be intercepted by an AI player after being kicked?

This question has been asked many times before, but most of the answers give solution to the problem where ball (target) is assumed to be moving at a constant velocity. In my scenario, I'm making a ...
0
votes
1answer
389 views

Capsule to Sphere Collision

For my Maths unit at university, we have to manually calculate if a sphere is colliding with a capsule collider. The information I have to go with is this; You have the following Sphere: LadyBird3 -...
0
votes
3answers
134 views

Why is the derivative important in game development? How did you use it in a real scenario?

I'm really eager to know how a programmer finds useful a derivative in game development, using a real scenario as an example. Also I plan to use this question to understand the importance of ...
0
votes
1answer
105 views

Java Simple 2D Grid Pathfinding

I want to code some basic pathfinding for my bot in Java. Below is a 2D grid representation of the 3D world. 0s being the places you can go, and 1s being the places that you cannot go. ...
25
votes
3answers
36k views

How can I project a 3D point onto a 3D line?

Let's say I have a line defined by two points, A and B, both in the form (x, y, z). These ...
0
votes
0answers
31 views

How to find player movement speed in Forge/MCP?

I want to predict where a player will be next based on where they are now. I have access to their XYZ, their motion in each direction, but I don't know how fast they are moving. Let's say that the ...
5
votes
1answer
4k 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, ...
0
votes
1answer
191 views

Axis of affine transformation matrix

Let's say I have a right handed column major 4x4 transformation matrix. Can I safely assume (even though there exist non uniform scale) that first column is X axis vector, second column is Y axis ...

1
2 3 4 5
37