# Tagged Questions

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

33 views

### Move to specified coords - libgdx and java

So I am making my bullets go to a point and travel further. Only its acting really really weird. Its like its thinking that the 0,0 location is at the top left instead of the bottom left. This is the ...
22 views

### Turning x and y difference between two points into a projectile moving between them at a fixed speed

In a libgdx project of mine, I have two units on a 2d field who want to fire at each other. They both know the x and y distance to each other by subtracting their enemies position from their own: ...
67 views

### Polygon 2D collision response- How do I find the correct edge a polygon hit?

Hey guys I've been seriously stressed out by this, so please go easy on me. My goal is to reflect a bullet (polygon) off of another polygon, and find the edge the another polygon, A (the bullet), hit....
84 views

### How to align a hint arrow to point along a path?

I am using CalculatePath and trying to use path.corners in order to give user a hint for path, that where should he lead next. I am using first two instances of Vector3 of path.corners. Lets call ...
27 views

### Vector and aabb collision [duplicate]

Im having trouble with bullet collisions for a 3d game. I've seen many solutions but they either don't work for my case or are way to complicated. Can someone explain in a pretty simple way how to ...
44 views

### Moving along the surface of a mesh?

I'm trying to replicate the movement in this game: https://www.youtube.com/watch?v=OcvD8BXars8 The players ship along with all other game elements move along the surface of a mesh. I've tried ...
41 views

### Unity C# - The object of type 'Object' has been destroyed but you are still trying to access it

I have a cube on a plane and I'm tring to move it to certain locations. I've baked the area and added a navmeshagent to the cube. My moving script for the cube looks like this: using UnityEngine; ...
91 views

### Java Distance between two Vector positions never 0

I have a Player moving, but when the player reaching the destination it should stop. But problem is that distance never return 0. It starts printing this: 0.9672514210000003 End by this and then ...
55 views

### Unity Vector3.Angle() direction

I have a space fighter AI. I need to determine how to pitch, yaw and roll the craft to aim at the target. My current solution: To obtain the Yaw angle to position the target above the fighter, ...
94 views

Does the AddForce method continue add velocity to an object forever? Does it need to be limited by another line of code? Sorry if it is too broad or too simple; I am completely new to programming and ...
84 views

### Unwanted roll when rotating camera with pitch and yaw

I have a quaternion class implementation, and when I apply this class to my objects all gone right (rotations), but I have a lot of troubles with the camera. I've been searching a lot trying to solved ...
43 views

### 2d vector flips during rotation

I have a 2d game (C++ and SDL) and I want the player object rotate to follow the mouse. The player object and the mouse location are both stored in 2d vectors. In order to have the player's rotation ...
34 views

### How to make this vector field animation

This screenshot is from Windows app called MyRadar by ACME AtronOmatic LLC. I found their wind direction animation to be very visually appealing and was wondering if anyone knew how to create this ...
86 views

### Shooting Projectiles

I am using cocos2D-x and am trying to achieve the effect of enemies going past and shooting projectiles at the player who is moving around the screen. I am using the code below, which is based on this ...
55 views

### Simulating elastic ball collisions quickly escalates to disaster

I'm trying to learn HTML canvas and was working on a basic physical simulation, where a number of balls are drawn and set in motion, and the program simulates them colliding and bouncing off the walls ...
108 views

### Getting the Right Vector from the Forward Vector

I'm currently working on a small Camera (ArcBall) and I finally am starting to understand how it will work. I will first create a basic View Matrix using a LookAt function. Then, I will send the ...
110 views

### Implementing proportional navigation in 3D

Good afternoon guys, a = N * λ' * V is the formula for the commanded acceleration required to hit the target, where N is the proportionality constant, λ' is the change in line of sight and V is ...
18 views

### Correcting Vectrosity wire frame line normals

Current Setup This is my current scene, you can see that as the sphere rotates it looks like at the edges(90 degrees) to our normal you see the lines fine but dead on the almost disappear. Grid ...
92 views

### How do I handle parallel lines when looking for intersections?

I'm using the following method to determine the intersection point of two vector2: public static Vector2 LineIntersectionPoint(Vector2 startPoint1, Vector2 endPoint1, Vector2 startPoint2, Vector2 ...
33 views

### How to rotate a triangle to look at a point?

Lets say I have a triangle defined by 3 vertices and a center point, how do I rotate the triangle so its normal is looking at a specified point?
33 views

### Position of an object relative to another in a 2D plane

I have two objects, A and B, each of them has a set of coordinates (x,y). How do I understand where is A in relation to B's position? If I where to just check each coordinates I could do it like this:...
121 views

### Get perpendicular vector from another vector

I should clarify that I understand there is an infinite amount of 'perpendicular' vectors in 3D space. I am creating an electricity effect, and to do this the ability to have any number of ...
66 views

### Convert a modified Transform.forward to world space

I am trying to make an electricity system, where it is given the start and end points and it works out a random sequence of points in the rough direction of the end point. These points are set as ...
150 views

### How to get the closest “visible” object from my “player”?

I'm using Unity 3d and i have to accomplish the following task: get the closest "visible" object to my player in forward direction. It is a sort of radar. I don't know where to start. Any advice ...
44 views

### Smoothing a rotation vector

I am currently using OpenCV to track the face of a person. With this I extract the feature points and calculate the objects heads pose by applying the "solvePnP" function. This function gives me a ...
96 views

### Why does transforming a Vector3 by a Quaternion result in reversed Z?

I'm trying to transform the vector (1, 0, 0) by an orientation unit quaternion, which in XNA should be: Vector3 v = Vector3.Transform(Vector3.Right, Orientation); But this results in the Z value ...
17 views

### how can i take the value of a vector 3 from a liste of vector 3 [closed]

foreach (Vector3 posit in position){ if (ang){ float a = Random.Range (0.0f, 60.0f); //Vector3 p1= new Vector3((position[i-1].x)+(ra*cos(a)),0.0f,(position[i-1].z)+(ra*Sin(a))); ...
54 views

### Dot product not working as expected

Recently I am learning dot product, While below code works from Unity's documentation, http://docs.unity3d.com/ScriptReference/Vector3.Dot.html public Transform other; void Update() { ...
33 views

### Limit Quaternion/vector3 axe in a certain interval

I have some trouble to understand, and handle Quaternion and Vector3. I'm improving the tutorial Tank of Unity: EDIT: Because a video explain so much better, there is a link to the 30 secondes video ...
29 views

### Translating a world position to an array position

Lets keep this simple, so, assuming I have an array like this ... var array = new bool[10,10,10]; .. and then I have a start and end vector3 ... var start = new Vector3(-21,-21,-21); var end = new ...
66 views

### Should I Include the W-component of a vector when calculating it's length or dot product?

The reason I'm asking this is because I saw an implementation which did it that way but I don't quiet understand it. I mean, usually I want to get the distance between two points in 3d space and if W ...
71 views

### Player position not updating when referenced in seperate class?

In my player class I have my players position set to update when you tap the directional keys, that works fine, but when I access my Players position variables, in my projectile class constructor, ...
132 views

### How to clamp a direction vector within a direction pyramid?

In 2D you can specific an angle range such as [-45 to +45] and clamp a 2D direction vector within that angle range. I want to have something similar for 3D. I want to specify the allowed directional ...
373 views

### How to calculate the closing speed of two objects

I have the 2D positions and 2D velocity vectors of two objects. How do I calculate the closing velocity ? I want to get the closing speed. Think of one jet tracks another jet with radar and you want ...
36 views

### Object has its heading stored as Euler angles. After it makes a turn, how do I calculate the new angles?

Assume said object is an aircraft. I store three angles (in degrees) that describe where it's headed: yaw, pitch and roll - in that order. Let's say the plane is flying vertically, upwards. The angles ...
70 views

### How does this math behind converting angles to vectors work?

I calculated the vectors of my yaw and pitch successfully. Even tho it works fine, I can't seem to understand how the math works exactly. Could someone (graphically / demonstratively) explain me this ...
48 views

### Velocity Relative To A Vector

So I have a velocity vector b in world space and I have a "pointing" vector a in world space. I need to know how to make the velocity vector to be relative to the "pointing" vector. Better explanation ...
44 views

### How do I get a vector from an angle?

I want a ship to move forward in the direction it's facing when you press the up key, but I don't know how to get a normalized vector from the angle the ship is facing. Can someone show me what code ...
61 views

### Getting vector relative to other vector in rotating object

So I have a rotating object a. It is rotating at non-constant speed around it's local x axis. It is parented to object b. When the object a rotates, it's local x axis stays facing the same direction ...
191 views

### How do you build a rotation matrix from a normalized vector?

I'm trying to find the correct way to build a rotation matrix from a unit vector. I have two arbitrary points in space (p1 and p2), and I'm trying to create the vertices for a rectangle to span ...
47 views

### Get vector3 position of Cursor on a fixed 2D plane within a 3D scene

How is it possible to get a cursors X and Y Location relative to the scene planes rather than using co-ordinates based upon pixels of screen height and width? I have the start of a very basic game, ...
32 views

### What Is Vector Math? [duplicate]

Okay so I was wondering, what exactly is "Vector Math"? I was wondering if I needed to know physics for game development, and most people said you just need to understand the basics, but they said ...
126 views

### Euler angles to directional vector

I wanted to implement a directional light system in my game, and instead of passing the direction to the light, I chose to use an angle, and only later convert it to a directional vector, so it is a ...
106 views

### Moving a ship forward from rotation

I am making a simple space simulator, where the player can control a ship using 2 controls, one for pitch and one for bank. The ship is properly rotated but I cannot figure out how to make the ship ...
153 views

### Vector math to calculate the rotation and drift of a tectonic plate?

I've been following the excellent Experilous procedural planet generation post, trying to recreate it in Java using libGDX. My planet is simpler, as it lacks any distortion of the mesh. It's just ...
32 views

### Movement for Box2D Bodies

I'm having trouble wrapping my head around something that should be relatively simple. I'm making a breakout clone using LibGDX and Box2D. I'm also using the Ashley ECS. For movement with bodies, I ...
61 views

### find Vector2 libgdx

I need to get coorinates of red point. Coordinates are just for example, it would be better to see the common formula. Found code like this, but it gains wrong result.() Vector2 o = new Vector2(6f,2f)...
284 views

### How to apply friction vector to acceleration in top-down 2D game?

I'm making a top-down view 2D RPG game, meaning the player can move in any direction on a 2D plane, and I'm trying to implement a somewhat realistic non-orthogonal acceleration/friction physics model ...