# Tagged Questions

Arithmetic, geometry, calculus, and all else which resolves the number-crunching necessary in a game. Math questions are those that deal with the formulae and calculations used by the game in various parts.

42 views

### What does it mean to cross a scalar with a vector in a 2D plane?

At the moment, I'm following this page to create a physics engine. As per that page, I need to cross angular velocity by a distance vector to get relative torque and such, but I'm not sure how (in a ...
32 views

### Discrete mathematician? [duplicate]

I'm studying a relatively new mathematics degree called 'discrete mathematics'. This degree intertwines mathematics and computer science such that you can solve most mathematical programming problems ...
111 views

### How do I find two points at an angle on opposite sides of a circle?

With reference to my previous question: I'm using micklh's answer, which works perfectly. However, it calculates the gradient based on two points, a starting point and an ending point. I want to ...
86 views

### How do I compute the point of a triangle-ray intersection?

I have a line (the direction vector of the player) and a triangle representing the face of a model (so composed of 3 points). I can't find the mathematical operation to check if that vector is ...
152 views

### How much mathematics is involved in video game development? [closed]

I'm average at maths. Maybe a tad below average. If I was going into a normal career I'd be fine. But I want to create video games. Is a career in video game development still on the cards for me? I ...
130 views

### Day and Night Cycles and Skybox Blending

I've been working on adding day/night cycles and random weather to my project using the Neoaxis engine. The day/night cycles itself is pretty simple, just rotating the "sun" light around the Y axis. ...
1k views

### Why are radians preferred over degrees in game development?

I've been looking up the definition of radians and found out that mathematicians prefer them because they are derived from pi instead of being completely arbitrary like degrees. However, I have not ...
36 views

### Centering three rectangles of different size

If I have 3 different sprites, that each belongs to the same sprite but with different animations type. Each has a different width, height, in the sprite sheet. How do I adjust the 3 using math, to ...
88 views

### Smooth interpolation with variable time steps

My game engine just went through a small overhaul that changed its fixed time step loops into variable time steps ones. Though everything has already been adapted steadily to the new environment, ...
128 views

### Reducing Spherical Harmonic Ringing

I've generated some 2nd order SH light-probes from cube-maps in my scene and I was surprised how strong artifacts are around the back of the dominant lights. I switched to a Lambert source plus ...
290 views

### Calculating 2D Physics Prediction of Shot Angle with Moving Velocity of both targets

I currently have the math right to hit a moving target with 99% accuracy as long as I don't move. When I start moving the aim is nearly 80%, it should also be 99% accuracy because the target is moving ...
162 views

### Code to generate a color gradient within a texture using a diagonal line

I want to generate a color gradient between two colors from x1,y1 to x2,y2. I'm unsure how to do this though. I can use Color.Lerp to get all of the color steps, but the problem is that I don't ...
4k views

### Comparing angles and working out the difference

I want to compare angles and get an idea of the distance between them. For this application, I'm working in degrees, but it would also work for radians and grads. The problem with angles is that they ...
71 views

### Animating values using splines

I'm trying to create a system similar to Blender's f-curves or Unity's animation curves (google it, I'm not allowed to post more than two links yet). It's basically a 2D spline where time is on the ...
87 views

### margin of error trying to check if a point lays on line

Working with floating point values it is as easy as breathing to run on approximation errors by comparing quantities which should be the same. I want to know if there is a way built in some MSDN (or ...
93 views

### Game maker, issues with an equation

Hello I am having an issue getting this equation to work, even with manually entering values replacing the variables. I cannot seem to get it to work, I have tested that the variables are being ...
103 views

### Straighter SLERP/LERP

I am debugging my Lerping to see how it works. It is rotating a card and it looks good. However the lerping contains way beyind the card is visually done rotating. I understand it has to do with the ...
366 views

### How to balance experience gain in an RPG

I am currently developing an RPG game with a classic experience-points and levelup mechanic. The player kills monsters, gains experience points, levels up when they collect enough and become stronger. ...
186 views

### In a semi-infinite procedural (chunk based) map, how do you handle objects larger than a single chunk?

I'll use an example to try and be more specific. Assume this is for a 2D top-down game. Chunks in this are made up of 32x32 tiles. If procedural buildings were to be generated based on some kind of ...
73 views

### Tennis game algorithm and maths

Tennis courts are real dimensions and game is 3D Ball has position (x,y,z), speed(vx,vy,vz) and acceleration (ax,ay,az) Game has 30 fps and on each update (1/30sec) it has these properties vx +=ax; ...
38 views

### Good way to integrate time to a quiz game [closed]

I wasn't sure which stack exchange site to pose this question to, so I'm asking it here, I hope it's appropriate. This thing I'm writing for fun is basically a mental math speed quiz game. I'm writing ...
68 views

### Trying to project a point onto a cubemap

I've got a simple test program with a camera within a cubemap (skybox). You can look around, and it feels like you're in a 3D room, but really it's just a cubemap image. Now I want to draw a point ...
95 views

### very simple math destination and speed calculation

My player goes to (destinationX, destinationY) His position is: (x,y) and the player has an update event function update() { this.x = this.x + dx; this.y = this.y + dy; } what is the formula ...
78 views

### Rotating one object to track another in worldspace

This should be pretty straightforward, but its been awhile and my brain has officially turned off for the holidays :-) To keep things simple, lets assume everything is in 2D space. I've got a large ...
115 views

### breakout game, computing optimal ricochet angle of a ball to get to a certain point

perhaps the title isn't clear so here is an explanation with a picture to better express my question Consider the following breakout clone game where the game is rigged to change the ricochet ...
96 views

### How can I determine trajectory from distance and time, without initial velocity?

I'm attempting to develop a Mortar that needs to lead it's shot to the target enemy. The shot will have a pre-determined constant flight time of (2.5 seconds) and it will have where the enemy should ...
63 views

### Shape collision checking

I want to check in an shape, wether an point is in it or not. The shape is descriped with one Array of float vectors. The vectors are added in clock direction. The first I can check very easy, the ...
452 views

### How do I find a point on a line?

I have two points (A, B) and the length of d. How can I find point C?
381 views

### How to rotate an object around world aligned axes?

I have a Vector3 which has an euler angle for each axis. Usually, when I want to create a rotation matrix I will use functions such as D3DXMatrixRotationX passing the respective angle from my ...
83 views

### Floating point memory usage on gpu

My question is simple: how much memory on GPU does one floating point value takes? I guess it is 4 bytes, but I'm not sure. So for example is it true that vec4, which holds 4 floats, each 4 bytes ...
736 views

### Predicting physics/trajectory for pool/billiards games

I'm thinking of making a quick proof of concept of a billiard-style game mechanic, where the player has perfect information of what is about to happen. Here's a good example: I'm only mildly ...
48 views

157 views

### Implementing frame-independent friction

So I'm not looking for anything realistic like a physics engine, just want to say that first. I'm working on a simple top-down game and I'm trying to get friction working with deltaTime. This was my ...
288 views

### Math to steer a car

I'm in the early stages of a city driving simulation project, and I'm having trouble with the math to determine how the AI should steer the cars. My car model is very simple, with nothing like ...
1k views

### Opengl-es picking object

I saw a lot of picking code opengl-es, but nothing worked. Can someone give me what am I missing? My code is (from tutorials/forums) Vec3 far = Camera.getPosition(); Vec3 near = ...
146 views

### Ray picking and bounding boxes in Java

How do I check which bounding boxes (of different types) a ray, sent from the camera through the mouse-click coordinates, intersects with first in Java (and where)? I have arrays (box_X, box_Y, box_Z, ...
119 views

### Predicting trajectory collisions for multiple moving objects [duplicate]

For the most simple of 2D games, I have implemented a posteriori collision detection (overlapping rectangles) on the xy Cartesian plane, but am now interested in understanding the basics of a priori ...
80 views

### Animation is too fast

I have an animation of a bullet but it seems to be going much faster than i was expecting. I currently set it to 0.5 pixels per second yet it seems to be moving way over hundreads of pixels per ...
158 views

### Do videogames use numerical solutions? [closed]

Do video games often use numerical solutions in their calculations, such as you might generate using software like MATLAB or Mathematica? Perhaps for making formulas for AI, or for game physics ...
176 views

### Finding roots/zeros for collision detection?

For the most simple of 2D games, I have implemented a posteriori collision detection (overlapping rectangles) on the x/y Cartesian plane, but am now interested in understanding the basics of a priori ...
145 views

### How can I implement jumping in a 2D game using bounding box collision?

Problem: I'm trying to implement basic jumping to my 2D game engine, but have failed several times. Basically what I've done so far is disabling gravity and using a separate function moving the player ...
35 views

### Sprite rotation algorithm [duplicate]

I'm making a game where you have to plot a function to hit certain objectives. I already made the plotting function and the animation to display a tiny missile that travels above the function. My ...
129 views

### Camera movement with slerp

I have 3 spots, I would like to move my camera to using slerp. Just As seen in the image below. My question is how I can connect my camera to the first spot? I should be able to move between other ...
43 views

### Rotating a joint to a desired angle

I would like to set the speed of my box2d revolute joint each update such that it will rotate to a desired angle and stop. My first thought was just to set the speed to +max or -max based on the ...
64 views

### Divide rectangular image into fixed number of random sized rectangles + 1 fixed size rectangle

I'm trying to divide a rectangular image into a fixed number of smaller rectangular image parts (of random but bounded width / height), with the exception of 1 rectangle which is predefined in ...
47 views

### Percentages for different platform generation [duplicate]

I have a level manager, which creates levels and levels create platforms. Levels can contain a variety of platforms. I dont really understand how I can say: I want a 10% of one platform being ...
245 views

### Accounting for waves when doing planar reflections

I've been studying Nvidia's examples from the SDK, in particular the Island11 project and I've found something curious about a piece of HLSL code which corrects the reflections up and down depending ...
201 views

### How to move an object up and down like a wave?

I am trying to move my object up and down using cos and sin, but I have problem understanding how does the sin and cos work, so I can make my object move up and down like a wave frequently Init Time ...