# Tagged Questions

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

21 views

### get vector of enemies that facing player [duplicate]

if I have player location (4,6,-3), thee y- axis is vertical and I have enemies at (7, 6, 12), (16,6,11) and (11,6,1) how to calculate the vector of each enemies that is needed to face the player? how ...
194 views

### Explaining vector math for a pendulum camera

I came across a code that I guess is doing a pendulum camera, that's the class name. I would like to know the math behind that. I would like also to know how to decipher those stuff in game math, ...
114 views

### MVP Matrix * Vector3 = Black Screen? [closed]

I'm relatively new to computer graphics so please take it easy. I created a ModelViewProjection Matrix and I sent it to my shader: #version 330 core layout(location = 0)in vec3 vert; uniform mat4 ...
3k views

### What's the 'proper' way to get unit vectors?

My apologies if I've misunderstood the term 'unit vector' or misapplied it in concept, but I think that is the term for an object's heading when expressed as [x, y] when x and y are a value between -1 ...
202 views

### Libgdx : point that scrolls on the edge of a circle

I'm not very familiar with libgdx vectors. I want to create my own joystick-controller and I want to know how can I find the coordinates of B by using Vectors. I can calculate the radius and I have ...
93 views

### What's wrong with my step-toward-target implementation? [duplicate]

I want to move a game object from its current position toward the mouse position. I wrote this Vector2D class to help me: public class Vector2D { private double xVect; private ...
144 views

### Edit spawn location according to vector direction

I'm trying to make a turret in Bukkit (Java). This will shoot an arrow to the players that are in the shooting radius. But now I've a little problem, the arrow gets stuck inside the block where its ...
196 views

### 2 component unit vector

Is it possible to store a 3d unit length vector with only 2 components, for example as coordinates on a unit sphere? It seems possible but I have never seen anyone do this. Would this be at all ...
2k views

### What is a direction vector and why should it be normalized?

I've been trying to get the hang of vectors and I read Wolfire's blog about linear algebra and I seem to understand most stuff except when it comes to storing a direction as a vector and using it by ...
565 views

### How do I find the closest points(thereby forming a polygon) enclosing a particular point?(see image)

I am working with a game engine, and my task is to add code for simulating fracture of rigid meshes. Right now I'm only working on breaking a cube. I am using Voronoi's algorithm to make a (...
298 views

### How do I find the angle between two 3D angles represented in this form?

I have two 3D angles, represented by [a1,a2] [a1,a2] where the a2 is < 180. My coordinates are represented as [X,Y,Z], where X,Y,Z are 64 bit ints (longs in my lang). My direction angles are ...
176 views

### Converting A 3D Rotational Vector Into A 3D Forward Heading Vector

I need to do a raycast which accepts a Vector3D StartPos and a Vector3D EndPos. I have available to me the characters position and the cameras rotation in 3D vectors. I need to somehow compute a '...
355 views

### Shooting based off mouse position [duplicate]

I'm trying to shoot bullets where the mouse is aiming using one image as a test. I'm trying to get the mechanics like this I have some kind of algorithm to handle that but the results arn't too good....
4k views

### Simultaneously translating and rotating sprite in Unity

I have a 2D object (a PNG file I dragged onto the screen) which is a circle I would like to move left and right when the correct side of the screen is touched and have it rotate in the respective ...
181 views

so I'm doing lwjgl, so far I have the loading of 16x16 textures from a 256x256 spritesheet all working, using this code to get the location of the textures: public Vector2f[] calculateUVMapping(int ...
215 views

### Rotating a vector around a vector in 3D space

I am trying to rotate a moon around a planet (the planet is also rotating around an axis) but I am having trouble doing so. I tried to make the model move through space like so: @Override public ...
347 views

### unity3d-Find angle between 3 vector3 points obtained from swipe

I was trying to find the angle between 3 vector3 points obtained from the screen swipe. The first vector3 point is the first touch position fp, the second is some intermediate touch ip and the third, ...
1k views

### Spritekit - gradually apply force vector in different direction (space ship turning)

I have a space ship that I'm applying a force vector to using a joystick for control. I would like this to smoothly fly around when I'm switching directions.. Exactly like minisquadron if you've ...
49 views

### How to make a game like “pewpew”? [duplicate]

I have a question about the graphics of these games like "pewpew", "geometry wars". Pewpew. Visit here: https://play.google.com/store/apps/details?id=com.jyaif.pewpew&hl=en How these games are ...
3k views

### Orthographic Camera and Raycasting in Three.js

I'm working on a test project porting a simple game from iOS to Javascript. I've got the orthographic camera working and it can view the objects in the scene and move up and down the tower of meshes ...
998 views

### How to find point on a circle that's opposite another point?

How do I find the coordinate of point and angle value on circle sprite which placed on opposite side of sprite from a touch point and the center point of the sprite? I know A position, B position and ...
629 views

### How to add a constant horizontal force just like gravity?

I want to add a constant horizontal force, just like gravity to a projectile or a sphere moving in 3d space, which will make the projectile or ball or sphere or whatever be influenced by this force so ...
226 views

### Collision detection: Swinging bat/racket and ball

I am programming a side-view tennis game, inspired by an old arcade game, using Javscript and HTML5 canvas elements. The player can move left and right and holds a racket at arms length which can be ...
371 views

### Closest distance from 3D point to vector line

First let's have a look at my little drawing: I have an origin point p1 defined by x, y and z co-ordinates, and a vector v given by x, y and z magnitude. I also have an arbitrary point, p2, given ...
114 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 ...
581 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 ...
2k views

### How to move Vector2 along angle?

These are my Vector2's that I am using for this function. public Vector2 position = new Vector2(); public Vector2 velocity = new Vector2(); public Vector2 movement = new Vector2(); public Vector2 ...
96 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 ...
591 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 ...
231 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 ...
227 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 ...
473 views

### Sorting for 2D Drawing

I am drawing a game in 2D (isometric) My objects have their own arrays. (i.e. Tiles[], Objects[], Particles[], etc) I want to have a draw[] array to hold anything that will be drawn. Because it is 2D, ...
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 (...
809 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 ...
268 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 ...
372 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 ...
860 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 ...
268 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 ...
183 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 ...
285 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

### Intelligently move aircraft using curves

I am trying to code a script to move an aircraft entity from point A to point B and at some point in the middle of moving have the aircraft forward vector face Point C (to fire a missile at an enemy ...
271 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 ...
133 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 ...
755 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?
935 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, ...