# 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.

117 views

### Explaining vector problem

I'm trying to simulate a centipede game, and I'm doing the snake movement. I have seen that piece of code, but can't get it, I know it gets the different between the current, previou's nodes ...
113 views

### Propel entities at some angle (depending on explosion's position)

I have a 2D platformer. There are multiple particles that are just 1x1 colored pixels. Let's assume there are 256 particles laid out as a 16x16 cube. Say I popped an explosion right in the middle. All ...
235 views

### Drawing the same scene with perspective then orthographic projections

I have a scene that I'm rendering first with a perspective matrix. I then want to rerender it in a different viewport using an orthographic matrix for a top-down 2D view of the scene. I think I may be ...
4k views

### Does a minor in math increase my hirability?

I've been pondering this question for some months now, and have been unable to get an answer from anyone in the industry (likely because I know no one in the industry). I am currently completing a ...
60 views

### Picking problem with rotated view matrix

I have picking code that works, if my view matrix has no rotation (only translation). Now If I rotate my camera, picking goes to hell. I cant find whats wrong My code: ...
134 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 ...
82 views

### Determining axis to rotate around

I'm trying to implement a free-look third person camera (using glm). I know that the general transformation is newCameraPosition = translate(lookatPoint) * rotation(angle,axis) * ...
110 views

### The math behind Variance Shadow Maps - moments

I am not asking how to implement them (that's not particularly difficult), but I'm having a bit of trouble understanding why the moments used in Chebyshev's inequality (indirectly) are equal to the ...
99 views

### Smooth Ramp to zonal harmonics

I have written in blitz3D some code to generate arbitrary 2D lighting lookup textures and I'm looking for a way to compress them. The idea is that they look rather smooth and low frequency, there must ...
396 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?
99 views

### Designing a four-directional movement control

I'm developing an RPG for iOS. Currently, I plan my controls to look like this: So the user can interact with objects, people, etc. by tapping on the right side of the screen, and moves by swiping ...
86 views

### Symmetry preserving path simplification

I'm using the Douglas peucker (DP) algorithm to simplify some (2d) closed paths forming a shape. This works pretty good, but not so much for closed paths that have some symmetry. Take for example a ...
207 views

### How do I get the areas enclosed by an arbitrary 2D shape?

In my game I want users to be able to draw arbitrary 2D shapes of any length around game objects. The shapes must be closed and drawn with a single stroke that does not overlap. For example: I ...
136 views

### Rotate a point in 3D space with sine and cosine

I got my camera controlled by the mouse. Now I want a sphere to be always in the center of my view(just for testing). I tried that by assigning the sine of the Y rotation of the camera times 10 as the ...
176 views

### Collision detection in games in 3D - edge to edge cross product

I am having trouble understanding why, in a game collision detection, separating axis determination requires checking for the cross product of edges of the two polytopes as additional potential ...
1k views

### top down game - checking, drawing enemy's line of sight area with obstacles

Examples of what i'm going to need: I'm using cocos2d to draw a CCTMXTiledMap, on those tiles i'll have to draw the LOS cone. How would i test if the player is within that cone, taking obstacles ...
77 views

### Trouble figuring out some attack/defense formulas. What should I change? [duplicate]

I'm working on something which requires a hunter to attack an animal. This is what I have so far. Attacker/Weapon POV Level - 1 to 50 Base - base attack level of the weapon Weapon Impact - ...
62 views

### Get rotate angle using a formula

I am developing a game that is being played on a board with the top first tile having the coordinates [0,0], the next one has [0,1], second row has [1,0]... and so on (most likely this would be a ...
120 views

### How to get the angle to an object from angle you are facing [duplicate]

I am making an creature simulator where the creatures have a neural net for a brain. One of the inputs to the net is the angle it has to travel to go to be facing the nearest piece of food. I can get ...
215 views

### Normalizing the direction to check if able to move

i have a a room with 4 walls along the x and z axis respectively. My player who is in first person (therefore the camera) should have collision detection with these walls. I'm relatively new to this ...
182 views

### Space Strategy Ship Movement Math

This is similar to a question I asked a while ago, but I phrased it so terribly so might as well start over. I am trying to implement ship movement in 3D space, but confined to a 2D plane at y=0 (see ...
508 views

### How can I maintain a rectangular formation when units are added or removed?

I've got bots in a rectangular formation with rows and columns. A problem arises when a bot is added or removed from the formation. When this happens, the bots have to rearrange themselves so that the ...
160 views

### Implementing a time scale in game with fixed physics update

I'm currently putting together my game loop based on the "Fix Your Timestep" article at gafferongames.com. This is going fine, but I'm also trying to implement a 'time scale', i.e. a way to control ...
97 views

### 2D vector to Quaternion

I have a 2D vector (with only X and Y), and my engine only supports orientation through Quaternions. How do I translate a 2D vector to a quaternion? The X and Y represent the direction (so X = 0 ...
85 views

### Follow sinus with absolute value

I would like to make an arm follow the sinus of the ball. When I add an absolute value to the ball (on the y axis) to get a more realistic bounce, the ball is going 2 times faster. How could I ask ...
995 views

### Find the closest point along a rectangle, given an another point and direction

Given a rectangle, and a point with a vector direction towards the rectangle. How can I find the closest point on the outside of that rectangle to the point in question?
518 views

### Isometric - precise screen coordinates to isometric

I'm trying to translate mouse coords to precise isometric coords (I can already find the tile the mouse is over, but I want it to be more precise). I've tried several different methods but I seem to ...
134 views

### Display and Hide CCSprite with Genie effect

I am new at cocos2D. I started to learn cocos2D with simple game from http://www.raywenderlich.com/tutorials#cocos2d tutorial. Now I'm crazy with animation, so now i want to display CCSprite as OSX ...
148 views

### Trying to convert as3 Matrix to C++ glm matrix

I am trying to convert a library called DragonBones to C++ Opengl which allows you to use Flash based skeletal animation. I'm almost done but I am running into a problem. I am trying to transform the ...
124 views

### Precalculate the position of a rotating Aircraft

To start honestly, this question is probably mostly handling math. But thats only the road I tried to go and failed miserably, so maybe theres a much more simple way to do. Ok the game situation is ...
74 views

### Need transform matrix to translate the center of the view to a custom position within the target texture

My problem is as follows: I want to use a single render target texture for drawing 16 viewports where I want to display the 16 different combinations of the marching squares algorithm with my 3D ...
101 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 ...
65 views

### Surface normal to screen angle

I've been struggling to get this working. I simply wish to take a surface normal and convert it to a screen angle. As an example, assuming we're working with the highlighted surface on the sphere ...
116 views

### Determining explosion radius damage - Circle to Rectangle 2D

One of the Cocos2D games I am working on has circular explosion effects. These explosion effects need to deal a percentage of their set maximum damage to all game characters (represented by ...
406 views

### Procedural dungeon generation. No corridors, color key doors

I am curious how dungeons like the one in Runescape dungeoneering skill are generated. They basicaly have a 10x10 grid. So theres 100 rooms total. There's starting room and exit room. And each one are ...
182 views

### Matrix multiplication - Scene Graphs

I wrote a MatrixStack class in C# to use in a SceneGraph. So, to get the world matrix for an object I am suposed to use: WorldMatrix = ParentWorld * LocalTransform But, in fact, it only works as ...
196 views

### How to balance this Pokémon simulator metagame by feedback?

This is a Pokémon simulator where you build a team of 6 pokémon and battle with someone. Unfortunately, some Pokémon are stronger than others and only a few of the hundredth species are practical. I'm ...
98 views

### Which is the right way to build a OpenGL Projection Matrix

This time I'm trying to learn the core of matrix transformations. I dont like the idea to using a Math library and dont understand what is hapening on background, because this I'm having some ...
198 views

### Making Ball Fling in a Curve Direction

I was wondering how to figuring out how to slice a ball (banana kick) by flinging it curve-ways. However, according to the LibGDX's gesture listener, the method for flinging only focuses on a straight ...
725 views

### Algorithm to shoot at a target in a 3d game

For those of you remembering Descent Freespace it had a nice feature to help you aim at the enemy when shooting non-homing missiles or lasers: it showed a crosshair in front of the ship you chased ...
121 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: Vector3 boneDir = getBoneWorldOrientation(mEntity, mHips) * ...
824 views

### What is a good way to determine if a vector is between two other vectors?

I could operate with the angles, but I do not have the angles calculated yet (and would like to avoid having to do that). It would be possible to calculate and cache the local-coordinate-frame angles, ...
39 views

### How do I fire a projectile at where an object will be located in the future? [duplicate]

I'm making a tower defense game where the towers are shooting projectiles at enemies. I do not want to make the projectiles homing, and I want to make sure that when a tower fires a projectile, it ...
164 views

### Is this Rotation Matrix correct?

I'm having heavly troubles with setting up a View Matrix and a Projection Matrix. It simply doesnt work. So I think my problem is related to my rotationMatrix function. I'm using this tutorial to ...
124 views

### How do I derive the angular movement for a craft

I have the regular (linear) motion implemented like this: class Craft{ ... Vector location, velocity, acceleration, angularVelocity, angularAcceleration; ... //the move class responsible for linear ...
82 views

### Getting half plane direction relative from cam position

Im implementing certain Camera movements in my turn based games. I'm able to place and rotate the camera between two units that attack each other. However it will always move to the same "side". Which ...
337 views

### Generate equal regions in a hex map

Taking for example large (X by Y) hex map, how can I divide the map into N regions of connected hexes to simulate countries? The goal is to generate a hex map that looks like a real life map with ...
135 views

### How good do I have to be at Math to create a 3D game using three.js? [closed]

A question I've often had, how good at Math do I need to be to create 3 dimensional games? I get along with 2d games just fine. I understand everything I'm doing without problems after practise. ...