# Tagged Questions

A mathematical concept that can be used to express position, direction or velocity and which can simplify or outright trivialise spatial problems.

5k views

### Implementing Separating Axis Theorem (SAT) and Minimum Translation Vector (MTV)

I was following codezealot's tutorial on SAT and MTV and trying to implement it myself but I've come a cropper when it comes to getting the correct MTV. Here is my example: (Cue pretty pictures...) ...
113 views

### How to get the normal that points *out* of a polygon

In 2D, each vector (x, y) has two normals: (-y, x) and (y, -x), pointing in opposite directions. Say I have a polygon and for each of it's edges I need to get the normal pointing outwards. In the ...
573 views

### Unity: Rolling a ball around a spherical planet with forces

I'm trying to make a game in Unity where the player character is a ball (a sphere), and the game world is a planet (a very large sphere) that the ball can roll around on. The ball can be rolled in any ...
95 views

### Reflection velocity

I'm trying to get a moving circular object to bounce (elastically) off of an immovable circular object. Am I doing this right? (The results look right, but I hate to trust that alone, and I can't ...
566 views

### How do I find a unit vector of another in Java?

I'm writing a Java formula based on this tutorial: 2-D elastic collisions without Trigonometry. I am in the section "Elastic Collisions in 2 Dimensions". Part of step 1 says: Next, find the unit ...
227 views

### What is wrong with my specular phong shading

I'm sorry if this should be placed on stackoverflow instead however seeing as this is graphics related I was hoping you guys could help me: I'm attempting to write a phong shader and currently working ...
224 views

### Eculidean space and vector magnitude

Below we have distances from the origin calculated in two different ways, giving the Euclidean distance, the Manhattan distance and the Chebyshev distance. Euclidean distance is what we use to ...
1k views

### Why isn't this physics code scaling velocities separately?

I'm working my way through this book and I'm trying to work this code out: var squaredVelocity = this.velocity.x*this.velocity.x + this.velocity.z*this.velocity.z; if (...
783 views

### How do I make a sprite move to another position using vectors

Ok, so far I have made the sprite move to a mouse position. But I got a question, does anyone know how to make a sprite move by itself without the use of a mouseclick from Point a to point b using ...
7k views

### Is there a good cross-platform C++ vector graphics library out there? [closed]

I'm making a game and want to use vector graphics. I started re-coding it using Cairo and the performance is horrific. So, I'm looking for a different library. It needs to be for C++ and cross-...
264 views

### How do I find the camera direction vector for 3D sound purposes? (C++, DirectX)

Question I'm trying to make a sound class for playing 3D sound effects with DirectSound and DirectX, without using DirectSound's 3D libraries. The plan is to have every game object constantly play ...
180 views

### Projecting a light onto a quad

I need to project the light onto the quad and use its value for translating the vertices. I'm currently having 6 vertices, two quads, The points are A X C B Y D Point X, Y are coming from two ...
364 views

### Spaceship acceleration for following waypoints

I'm creating a turn based space ship strategy game with simultaneous turn resolution similar to Steam Birds. After all the orders are given, the ships run through a real time simulation where they ...
850 views

### Dynamic thruster balancing of space ship

The space ships in my game a meant to be player-built with an arbitrary amount of thrusters attached anywhere with any rotation. I currently have some dirty code to rotate the ship to a given angle (...
64 views

### How to set LinearVelocity exactly in onSceneTouchEvent?

I'm beginner in Android programming. And i use AndEngine GLS2 with Body and AnimatedSprite. I have a object ball and i want to move it to follow my hand. This is description for my idea: And my ...
64 views

### How to rotate vector A around another vector B?

Lets say I know what is directly above a turret. I also know where the turrets gun is currently pointing. I would like to know where will the turret's gun will point if I rotate it. I suppose I could ...
262 views

### How to tell right from left: Finding the vector pointing towards the right side of a character?

We have two vectors: Pointing from the floor to a 3d character's head. Pointing from the character towards where it's facing. How do I find the vector point from the character towards the right? ...
60 views

### How to find optimal perpendicular axis of rotation vector to draw arrows?

I am drawing lines on the screen. Each line has a point (x,y,z) and a direction (u,v,w). I want to draw arrow heads on these lines, like two lines that start from (x,y,z) and leave at a 15 degree ...
275 views

### How to rotate a line in 3d space?

I am trying to figure out direction vectors of the arrowheads of an arrow. Basically I'm given a normalized direction vector (u,v,w) and I need the normalized direction vectors of the its two arrow ...
1k views

### Converting 3 axis vectors to a rotation matrix [closed]

I am trying to get a rotation matrix (in 3dsmax) from 3 vectors that form an axis (all 3 vectors are aligned by 90 degrees each other) Somewhere I read that I could build a rotation matrix just by ...
268 views

### Separating axis Theorem rotation issue

I made a post yesterday to see if anyone could understand my problem. However I did not receive much guidance, probably because my question was not clear. I have worked on it a little more and ...
132 views

### How to remove line between two Points XNA 4.0?

I'm new to XNA and wondering if it is possible to remove a line (that lies between two vectors) when the mouse clicks on that line. I've searched everywhere but I can't seem to find anything. My ...
724 views

### What is Vector Projection and what is it's use in games?

Couldn't find a clear enough answer on Google. I know what vectors are. But what does it mean to project a vector onto another, and what is it used for in games?
3k views

### Basic Car Movement, Converting 2D Vectors to 3D problems

I'm trying to follow this guys method for steering a basic car. Link. It's the first example I can sort of get my head around and I'm trying to convert it to a working 3D version. To get some scope, ...
917 views

### Using a vector to store multiple instances of a class

To warm up with SMFL, I am creating a simple Block Breaker game. For the blocks and balls, I would like to store them as "instances" in a vector so that they can be added/removed with ease. However, ...
291 views

### How can I calculate force and acceleration?

I have problem of calculating the movement of the object. At the moment, I have a vectors calculated from the center of the screen minus the position of the object. direction vector = centerScreen -...
487 views

### Ball bouncing at a certain angle and efficiency computations [closed]

I would like to make a pong game with a small twist (for now). Every time the ball bounces off one of the paddles i want it to be under a certain angle (between a min and a max). I simply can't ...
50 views

### Derive direction in which a spot light emites its light from a projection matrix

First of all, sorry if my question sounds too basic or even makes no sense. I'm new with game development I'm working with HPL1Engine, specifically, the lights parts. I need to know the direction in ...
57 views

### Getting the position of a directional light w.r.t. a moving object.

I have a forward vector of my object, which is a bike, and its position, and I have a directional light direction. I would like to know where the light is with regards to the bike position/...
556 views

### How can I project a vector on another vector?

I have a generic not normalized Vector3 v1 and I want to calculate its component along another Vector3 v2. I used to normalize the vector I want to be the direction and then multiplying the other ...
94 views

### How do I lock drawn lines to be orthogonal to an existing one?

I'm making a 2D game in Corona for Android/iPhone that is similar to Volfied. In my game, the user has to touch the screen to draw a line for the character to move along. How can I force the lines to ...
1k views

### View to normal calculation in GLSL

Sorry for the terrible title, but I really cant think of anything better.. Suggestions welcome. I am trying to do something like showcased in this video: http://www.youtube.com/watch?v=CaTI2d0tQME ...
381 views

### Adding an angle variance to a 3d vector

I am converting a particle emitter from 2d to 3d. In the 2d system the original coder used a random angle variance and added it to the angle. So it would be something like: thisAngle = emitterAngle ...
346 views

### matrix to rotate a vector to a known arbitrary axis

Let's say I have a vector V (v.x,v.y,v.z) which is normalized and points somewhere in 3d space. And that I have another vector Z of (0,0,1). Knowing only these two things I'm looking for a ...
214 views

### Tangent plane vectors smoothing with vertex normals [closed]

I'm trying to find a way to smooth out normals obtained from cross product of tangent and bitangent vectors calculated per face basis. I've already asked a similar question on SO, however with no ...
390 views

### How to know the relative facing angles between two players? [closed]

I want a grappling system similar to Tekken, in which different grapples animations are performed depending on which side of the opponent the player performing the grapple is facing. For example, ...
90 views

### Get a random vector

I'm trying to make a small pariticle-like simulation, and I'm trying to make each parrticle go a random direction from one point (mouse pos). The problem is I don't know how to get the random vector ...
1k views

### Shooting the bullet out of the gun instead of the camera, yet keeping it accurate with respect to the reticle

I'm working on a first person game, and I've ran into a problem. In my game, there's the player's gun being rendered, as well as a reticle in the center of the screen - like this: First, Let's ...
7k views

### How can I implement a directional melee attack?

I am attempting to make a top down game similar to the SNES Zelda games, in Unity 4.3, in 2D. When my character swings their sword, every enemy within a radius takes damage. I want to make sure that ...
3k views

### Convert atan2 value to standard 360-degree-system value [duplicate]

Lets say I'm using atan2 to get the angle between two vectors. atan2 gives a value in radians. I convert it to degrees using a built in function in Java. This gives me a value between 0 and 180 ...
4k views

### Using atan2 to calculate angle between two vectors

I understand that: atan2(vector.y, vector.x) = the angle between the vector and the X axis. But I wanted to know how to get the angle between two vectors using atan2. So I came across this solution: ...
169 views

### 3D vector graphics - maintaining correct Z 'length'

So I'm trying to build myself a 3D display 'engine', or whatever it ought to be called. I've been experimenting with PyGame, as it's familiar to me. In a way this has almost been more an excuse to ...
3k views

### How to move an object along a vector

Let's say I got an object A and object B in a 2D game. I create a vector leading from A to B. It's name is AB. How can I make A move along the vector AB and reach B? One way I was thinking of doing ...
19k views

### How can I calculate the angle and proper turn direction between two 2D vectors?

I am working on some movement AI where there are no obstacles and movement is restricted to the XY plane. I am calculating two vectors, v, the facing direction of ship 1, and w, the vector pointing ...
48 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 ...
273 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 ...
196 views

### Creating a textured object infront of the current character in unity 3d

I've spent about half a day trying to get my head round this and i'm not having too much luck, essentially what I want to do is play an animation and then once the animation has finished create a flat ...
190 views

### How to modify normal vectors with a tranformation matrix

Transformation is quite simple when it comes to Position or Color of the vertex, for Position just multiply matrix * vector and for color just don't do anything, but my question now is: How to handle ...