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
Join us in building a kind, collaborative learning community via our updated Code of Conduct.

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

0
votes
1answer
37 views

Feedback on Scoring System [on hold]

I would like to get feedback on ideas for the scoring system for the game I'm working on. This game is sort of a restaurant simulator (think Diner Dash) with a few tweaks here and there. One of the ...
1
vote
1answer
61 views

Convert Canvas Space point to local space of a rotated rect?

I got a quite tricky problem: I have my mouse position and my rectangle position in canvas space(screen space but with adjusted scaling). Now I want my mouse position converted to local space of the ...
2
votes
0answers
28 views

How do you find the collision between 3D boxes and 3D QUAD face meshes?

I have an axis aligned bounding boxes for 3D object collision, but I have a complex 3d mesh that's divided into 3d faces so I want to check for bounding boxes and collision with the faces of that ...
-2
votes
1answer
68 views

Turn based combat system [closed]

I'm trying to understand how to develop a combat system with turns like most android game (heroes charge is an example) Not a classic turn based system like Rpg, but a sort of game where the turn is ...
0
votes
1answer
53 views

From screen space to world space for a 2D game

I'm making a 2D game and I want the user to be able to position an object in the world using mouse input. After a while I found an answer to 'OpenGL Math - Projecting Screen space to World space ...
0
votes
1answer
28 views

Check whether a vector is to the left or right of another position

I don't know how to decide if my point is on the left or right side of another object. My first thought was to check if x-axis of object1 is bigger or smaller than object2's, but if my objects rotate ...
1
vote
1answer
36 views

Transforming a 2D Grid in 3D Space

Hi everyone, I'm trying to implement a 2D Grid in a simple 3D Editor. Here are some debug-rays I already implemented: Everything is working as intended as long as the object is not rotated. For ...
0
votes
2answers
35 views

Find Entity Orientation In Degrees Given Two Coordinates

I'm trying to find the orientation for an entity, as an angle in [0º-360º). I've searched for an answer and tried to implement something of my own, but it always fails on the edge cases. For a better ...
1
vote
0answers
53 views

How do I create the formula for calculate the damage of a skill

I'm trying to calculate the output damage of a skill. The skill can go up from level 1 to 100, it can scale with own levels and the attack of the character. Here some parameters Edit: I need a ...
2
votes
0answers
60 views

Handling a smooth movement over slopes in a worms like game

I currently have a worms like game with the worms style pixel perfect terrain destruction. Its working well for pushing things around and watching them fall, but for the players movement it feels like ...
0
votes
0answers
44 views

How do I find the texture origin using UV data?

I am writing a map decompiler for the video game Tron 2.0 and its map editor, DEdit. DEdit requires a set of three vectors in order to correctly map textures to each model. The vectors are what I ...
1
vote
1answer
59 views

how to put elements around circle with equal distance?

I know circle formula and know how to draw it. but I want put 4 points on it with equal distance from each other. how can I do that? I work with unity.
0
votes
0answers
19 views

How to find volume of convex 3D shape

I'm not sure what can be said that isn't in the title. The gist of it, is that I have a convex mesh delimited by polygons (can have more than 3 sides), and I want to find it's volume. Is there an ...
21
votes
1answer
2k views

Why do transformation matrices always have an extra dimension? [duplicate]

In 3D math I always see matrices with one additional dimension. For example, in 3D graphics, matrices are always 4x4 and in 2d they are 3x3 matrices. Can anyone explain why?
0
votes
0answers
23 views

Computing depth from position of fragment in world space

I have a raymarching shader which computes the location of a hit on the scene in world space. float3 worldPos = ... ; I can verify that the world position is ...
0
votes
1answer
47 views

How to store 3d transformation in a game?

I am curious what is the best strategy to save 3d transformation of a model. Here are the few choices I think about: 4x4 matrix 4x3 matrix(skip the bottom row of a 4*4 matrix) Dual quaternions with ...
1
vote
2answers
31 views

Rotate A towards B with limited turn rate

I want to rotate A towards B with a fixed turn rate per second. My math skills are very limited and I have no clue in how to accomplish this. Best Regards
0
votes
2answers
59 views

How to calculate object speed so it accelerates exponentially?

Think a rocket or a missile. Completely don't know how to make it start slow and then get progressively faster in an non-linear fashion, given max speed and base acceleration. Curve like this would ...
2
votes
1answer
259 views

How to use Moving Average to avoid lucky streaks in RNG

I spent the last week reading about Luck Mitigation and what a dev can do to avoid extreme cases where the player's psychology will be messed up. I came up to this question How do I avoid “too” lucky ...
0
votes
1answer
59 views

Rendering an isometric tilemap

I have a tile which is 512x256 pixels and I'm trying to render it in an isometric fashion. I have this helper function: ...
0
votes
1answer
71 views

Implementing a score system similar to Moon Patrol

I am working on an Android game scenario inspired by Moon Patrol. My beta version is available for beta test from https://play.google.com/store/apps/details?id=dev.android.buggy In my case, I got ...
0
votes
0answers
19 views

Predict Future trajectory of object with friction and changing direction over time

I have an moving character. I know these variables: Current Acceleration (constant) Velocity Ground Friction Current Location Destination (direction of acceleration vector * arbitrary number) as ...
4
votes
3answers
98 views

How to find the degree of interpolation?

I have two quaternions: A and B. I want to lerp between them. Given another quaternion C, I ...
0
votes
0answers
20 views

Failing to apply Max Rectangle algorithm

After asking this question, I have few problems trying to implement Max Rectangle Algorithm that is described here on page 19. I have a hard time implementing this, do you have leads or advices on ...
1
vote
1answer
57 views

Difference between integral and accumulator?

I'm trying to build a bouncing-ball effect, and a newbie to calculus things... For the ball-drop, it's straightforward - since there's no initial velocity and acceleration is constant. For the ...
0
votes
1answer
56 views

How to fit rectangles in a page?

Here's my problem: I need to fit rectangles in a polygon but in "certain way". I have few rectangular shapes (of different sizes) and I need to put them on a polygon. My first idea was to always ...
1
vote
0answers
72 views

Plotting 2D map coordinates to OpenGL 3D projection

I’m trying to convert a 2D map created in my map editor to a 3D plotting with OpenGL. This is my map generated in my map editor: Those vertices are relative to my Cartesian origin world coordinate (...
0
votes
1answer
49 views

Acceleration in Unity

I am trying to emulate acceleration and deceleration in Unity. I have written to code to generate a track in Unity and place an object at a specific location on the track based on time. The result ...
0
votes
0answers
12 views

(Houdini) Twist control for bones on curve using parallel transport algorithm (Rigging)

Hopefully you guys use Houdini and some math genius can help me. I have a curve where I used the parallel transport algorithm to transport the normal along the curve and then I use this curve as a ...
1
vote
2answers
155 views

Shrink a convex polygon

Shrinking a concave polygon is quite hard, to do well. But I expect shrinking a convex polygon would be easy. The naive approach of moving each vertex a certain distance to the centre gives me poor ...
0
votes
3answers
70 views

How to convert 3D coordinates to 2D Isometric Coordinates?

I wanted to make an isometric game which has a bouncing ball. I assume that there is a way I can "show" a jumping motion in isometric, since it has been done before, but I was unable to find the ...
0
votes
1answer
30 views

Collision of grenadelauncher shell

The shell of a grenadelauncher is very small (10cm) and the speed is very fast (80m/s). Collision detection using colliders is impossible. To get the collision point of a rocket launcher I send a Ray ...
0
votes
0answers
18 views

Mouse: Intelligent Focus Helper

h.e.l.l.o I tried to get a kind of focus helper with the mouse when the pointer rolls over an item. but i can get a good easing when the mouse are hover a element. I do not know if I explain myself ...
0
votes
1answer
31 views

Detect if mouse do multiple circle rotation around a XY point

would anyone know a method or algorithm (js) to calculate and detect if a mouse is moving by a circle around a target? Example if a rotate mouse *4 time around a specific XY point, i would like to re-...
0
votes
1answer
23 views

How to orient a layer to connect 2 points AND facing the camera

here is my question, which I hope will be in general interest: If you have got 2 Points in 3D space and want a plane to connect those, you can quite easily use a function similar to "lookAt" to ...
1
vote
0answers
20 views

Get world position from Fragment Depth

I am trying to write the depth value in a G-buffer pass and then read it later to determine the world-space location of a fragment. I have this shader which renders my G-buffer pass ...
1
vote
0answers
23 views

Get world position from depth buffer

I have a buffer I am rendering gl_FragDepth (remapped to range 0-1) to a color buffer (instead of color) in OpenGL I would like to, in a second pass, read this ...
0
votes
0answers
11 views

How to compute volume of intersection of non-axis-aligned cuboids in 3D?

Given two cuboids in 3D space (8 vertex coordinates each) that are arbitrarily oriented, how can we find the volume of overlap between them in the fastest manner?
3
votes
2answers
101 views

Creating terraced terrain

Let's say I have a heightmap, but I want to create flat areas on it. The easiest solution would be to just say that every value between 0.2 and 0.4 should just become 0.3, but to keep the terrain ...
2
votes
0answers
41 views

How to implement a pannini projection in opengl?

I have read about the pannini projection, which involves (I think) projecting a scene onto a cyclinder instead of a rectangle. How can I implement this projection in a vertex shader? Blinky is using ...
1
vote
1answer
86 views

Find Coordinates of Exit Point

I'm trying to make a bullet penetration system. Taking a look at the picture below could help explain what I want better. If we know the coordinates of a square shape as well as AB vector with ...
-3
votes
1answer
43 views

How perform for obj follow mouse with angle?

how i can perform for sprite follow mouse if i change angle ? If i change angle the sprite no more follow mouse correctly. I absolutely need the obj follow mouse with pivot. https://jsfiddle.net/...
3
votes
1answer
201 views

Procedural Star Generator

I want to develop a procedural galaxy / starfield generator. A rather simple approach would be to use some pseudo-random algorithm to repeatedly create a star and its properties (such as position, ...
1
vote
2answers
55 views

Deleting an item in the game world: detecting if an item supports other items

I'm writing a 3D construction module similar to the how you build houses in the Sims. Users are able to build walls and floors (which also act as ceilings) on multiple floors (layers). This question ...
1
vote
1answer
77 views

How to remove bricks on collision?

I am on my last stage of creating a simple breakout game in Java using BlueJ. I have added multiple rows of bricks using an ArrayList. However now the task is to ...
1
vote
0answers
40 views

Converging at position and angle using motor-based rigidbody movement

I am given a rigidbody positioned in \$\mathbb{R}^2\$. It is a box of length \$l\$ and height \$\epsilon\$. The position of the box's left center is described by \$\vec{p}\$, and its angle from the x-...
0
votes
2answers
65 views

Detect minimum speed of a dynamic node in 3d space

I have a 3d dynamic node with speed & acceleration vectors. It has maximum speed (magnitude) and minimum speed such as if it exceeds maximum or goes below minimum, it stops accelerating and the ...
0
votes
1answer
39 views

Unable to control speed of the movement - object jumps straight to the end of the curve

I have implemented curve movement for two sprites (moon and sun) to simulate daytime changing. Sprites should take turns one after each other and move over the sky. But they just instantly appear at ...
0
votes
2answers
351 views

Moving a 2D object along circular arc between two points

I have a sprite which I need to move along a curve between two points in 2D space. Speed must be consistent all the way. No physics involved. How can I achieve this? The object is sun sprite.
0
votes
0answers
56 views

How do I design XP (trophy) rewards for a progressive league system?

I'm working on a feature for a multiplayer game where players are grouped into shards of 50 and compete for higher ranks. Each match lasts around 3 hours. The higher the rank the more trophies or XP ...