Questions tagged [mathematics]

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

213 questions with no upvoted or accepted answers
Filter by
Sorted by
Tagged with
9
votes
1answer
111 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 ...
8
votes
0answers
256 views

How to move a portion of bezier/spline curve along its complete bezier/spline curve?

Based on the image below, I have a curve (orange) which is a bezier sub-curve of an original curve (longer black curve). The original curve consists of a number of cubic bezier curves joined together. ...
7
votes
2answers
527 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 ...
5
votes
0answers
70 views

Slot Probability Function

Please can someone point me in the right direction. I'm working on a slot game. that I'm having trouble figuring how to implement the probability function for. The game has a set of symbols that bets ...
4
votes
0answers
203 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 ...
4
votes
0answers
362 views

How to target moving object in 2D game

I am working on targeting system for 2D game. Two objects move in space. Each one have Position and Velocity vector. Ship object shoots moving objects in space. Ship can shoot in any direction, but ...
4
votes
1answer
111 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 ...
4
votes
1answer
129 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 ...
3
votes
0answers
63 views

Approximate doom/heretic-style freelook distortion with modern graphics APIs

Currently working on a doom-like engine with fewer technical limitations, and looking into rendering techniques. I'm aware doom's a raycaster, and I want to capture a similar look but with modern ...
3
votes
0answers
87 views

Calculate the aircraft's movement path in which its side speed is required

I am working on an implementation problem in which given an aircraft and the objective of the system is to find the quickest route (optimal in terms of time) from point A (contains the information of ...
3
votes
1answer
420 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 ...
3
votes
0answers
60 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 ...
3
votes
1answer
2k 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 ...
3
votes
0answers
33 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 ...
3
votes
0answers
116 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: ...
3
votes
0answers
251 views

Filling Closed Shapes

Game Engine : Unity 5.1 Developing on Windows 7 Hello, I am using Vectrosity to draw some some shapes on screen run time. I also need to fill these shapes and none of them are really trivial shapes. ...
3
votes
0answers
403 views

3D Zoom To Mouse Cursor accounting for Change in Camera Pitch

Overview: Simply put, I'm trying to make a zoom to cursor algorithm. This would normally be very simple, but the implementation of the camera is making it difficult. As the camera zooms in and out, ...
2
votes
2answers
149 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 ...
2
votes
0answers
696 views

Idle game: calculating resource generation/consumption

I'm making an idle game in the vein of Melvor Idle and I've run into a problem calculating the yield and consumption of resources while the user is away. For those who don't know, many idle games have ...
2
votes
0answers
39 views

How to apply a color transform to textures when using pre-multiplied alpha?

I'm trying to apply a color map to my textures. The map is a 4x4 matrix that adjusts the contribution of each RGBA channel returned from the fragment shader. My texture needs to use pre-multiplied ...
2
votes
0answers
55 views

Compute spheres 2D speeds in perspective projected animations

I created two animations that consist of spheres moving in a perspective projected 3D space, which means that the size and speed of the spheres vary with the distance: they increase when they are ...
2
votes
0answers
62 views

Orthographic camera produces strange results

I've created a basic orthographic camera using the following view projection matrix: ...
2
votes
0answers
271 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
0answers
93 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 ...
2
votes
1answer
339 views

Calculating real time moment of inertia around arbitrary axis in 3d

I have a 3d rigid body consisting of multiple triangles forming a closed mesh. I know how to calculate the moment of inertia around an arbitrary axis by splitting up the mesh into simpler shapes and ...
2
votes
0answers
119 views

Bullets moving with the camera, not the world, Java 2D

I'm building a simple 2D Top-Down shooter game in Java. I simply cannot get this to work: I'm moving the camera and world differently. The world is moving when needed (when not in one edge, so it ...
2
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 ...
2
votes
0answers
67 views

Weird warping with per-vertex normals

I've had this little problem for a while now, where for some reason my calculations for per-vertex normals results in a weird distortion or warping, skewing my lighting, shading, and reflection passes....
2
votes
0answers
331 views

Hex axial coordinates to table coordinates conversion

I am developing a browser game based on a hex map. I am storing my data based on axial coordinates system. I developed a function which shows me axial coordinates of hexes within ...
2
votes
0answers
355 views

How to calculate a quaternion rotation between 2 vectors with a specific final up vector?

I know you can calculate the quaternion rotation between 2 vectors with something like this after all the optimizations: ...
2
votes
0answers
46 views

get tetrahedron centroid velocity if vertex velocities known

If i have a tetrahedron and i know the velocities of the 4 vertices, how can I find the velocity of the Centroid? I know how to get the result if i know the velocity of the Centroid (i can use ...
2
votes
0answers
156 views

How to aim with a spaceship in 3D considering its angular momentum?

So I have a spaceship and I have 6 degrees of freedom. At a given moment the following vectors are known of the spaceship: Local forward. Local up. Local sideways (may be implied from the previous ...
2
votes
0answers
181 views

Stereo 3D: drawing 2D elements at apparent screen depth

I'm developing an application making use of DirectX11's stereoscopic features. At such I am not relying on nVidia's automatic implementation. That means I have to replicate a way to render 2d elements ...
2
votes
0answers
804 views

Quaternion to direction vector - flipping

I've kinda solved this myself by adapting the Camera::setDirection code from OGRE to work for my need: Now I have the following code: ...
2
votes
1answer
259 views

Ledge Detection with Plane Intersection?

i am working on a ledge climb system and I am currently refactoring it to make it more reliable. I am tracing with a sphere towards infront of my character. If it found something, I trace downwards. ...
2
votes
1answer
839 views

Computing the UV coordinates of a 3D point that lies within a 3D triangle

From a triangular mesh I have a 3D triangle T represented by 3D vertexes v0, v1 and v2. Each vertex has an associated UV coordinate into a common texture image, represented as uv0, uv1, uv2. ...
1
vote
0answers
47 views

Why does the clip length of an animation not match my math?

I need to re-create an existing animation. The new animation should have the same amount of frames and length and FPS. Unity shows the following for the original / existing animation: As one can see, ...
1
vote
0answers
32 views

how can I normalize the speed of a polygon moving over a series of connected quadratic bezier curves with varying lengths?

I am generating a bunch of quadratic curves that are connected together, creating an array of curves, and a function which returns the position on the curve for a given time. ...
1
vote
0answers
20 views

How can I draw a partial circle with LineRenderer?

I'm using the following code, which I found online, to draw a circle with a predefined radius centred on a predefined point in LineRenderer (2D game). ...
1
vote
1answer
63 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 ...
1
vote
0answers
45 views

How can I calculate the inertia tensor of a hollow object defined by a triangle mesh?

I want to calculate the mass, center of mass, and inertia tensor of player created objects. Some of the objects will be hollow instead of solid. I am creating a closed triangle mesh for their object. ...
1
vote
0answers
34 views

Reinterpreting point inside a distorted cube

Given a cube: And a point anywhere inside that cube. Could that point be reinterpreted given any kind of deformation applied to the cube? I.e., where would that point be inside the deformed cube? ...
1
vote
0answers
22 views

Statemachine to behaviour tree?

Background I was able to convert simple statemachines like this... Into a BT looking like this (Notation describtion)... ...
1
vote
1answer
81 views

Calculating probabilities for a custom drop table system

I have a "drop table" / "loot table" / "item table" / "whatever you want to call it" system and I need to solve two Problems. Apologies in advance for the text ...
1
vote
0answers
26 views

Formula to convert zoomed in game space co-ords to UI

I need to come up with a formula to convert variable zoomed-in game space co-ords to UI co-ords. The engine I'm using is not traditional so there's no inbuilt function (convertToUISpace etc). Now I ...
1
vote
0answers
114 views

My arcball camera does a roll when it shouldnt be

I am trying to build an arcball camera and it's mostly working, the problem is that as you rotate around the object you have selected (orbit_target_pos in the code),...
1
vote
0answers
92 views

Calculating spaceship course

There is an idea for (soft) sf strategy game following me for a long time but I need to get a grasp of some math before moving further with it. Lets assume there is a spaceship traveling (in space) ...
1
vote
0answers
159 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 ...
1
vote
0answers
30 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
0answers
22 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 ...

1
2 3 4 5