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

learn more… | top users | synonyms

1
vote
1answer
74 views

Rotating a 4D matrix about the Y axis with an X-Z vector

I should mention that I'm pretty new to Matrices and will probably need a layman's answer to my question. I have a 4D matrix which represents the rotation of an object in 3D space. I have a ...
0
votes
0answers
25 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; ...
1
vote
1answer
73 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 ...
1
vote
1answer
37 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, ...
2
votes
1answer
79 views

Find your value between four values in a grid based on distance, Unity

Please note: Originally posted in stack overflow, redirected due to nature of problem. I am making a procedural mesh game. I am trying to calculate the temperature for the player's current chunk by ...
3
votes
3answers
85 views

Does AddForce continue to add force indefinitely?

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 ...
0
votes
1answer
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?
0
votes
1answer
66 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 ...
1
vote
2answers
983 views

Detecting walls or floors in pygame

I am trying to make bullets bounce of walls, but I can't figure out how to correctly do the collision detection. What I am currently doing is iterating through all the solid blocks and if the bullet ...
3
votes
4answers
142 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 ...
2
votes
1answer
37 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 ...
0
votes
1answer
54 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 ...
0
votes
0answers
28 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 ...
2
votes
1answer
224 views

Problems with Raycasting Requirements

Im working on a script which kinda works like an Enemy AI. Its kinda like a detection system with requirements that are required to be met. This is a recent question i asked using my code Raycast ...
1
vote
1answer
82 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 ...
1
vote
1answer
54 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 ...
0
votes
1answer
72 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 ...
4
votes
0answers
103 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 ...
0
votes
2answers
84 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 ...
0
votes
0answers
12 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 ...
3
votes
2answers
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 ...
0
votes
1answer
28 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:...
1
vote
4answers
99 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 ...
1
vote
1answer
37 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 ...
3
votes
1answer
380 views

Controlling roll rotation when travelling along bezier curves

I am currently working on a curve implementation for use in Unity which includes an editor: The aim is to get an object to follow the path represented by the curve at a constant velocity. Currently ...
3
votes
2answers
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 ...
0
votes
3answers
284 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 ...
-2
votes
1answer
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))); ...
0
votes
0answers
50 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() { ...
0
votes
1answer
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 ...
5
votes
2answers
6k views

How do I use the dot product to get an angle between two vectors?

I am learning to use normalized vectors in my games. I've learned that in order to know the angle between two vectors, I can use the dot product. This gives me a value between -1 and 1, where 1 ...
1
vote
2answers
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 ...
2
votes
1answer
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 ...
0
votes
1answer
68 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, ...
3
votes
2answers
144 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 ...
0
votes
1answer
169 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 ...
0
votes
1answer
103 views

Would Raycast suffice for a game clock based on sun position?

I need help with some logic in my script. I created a dynamic day/night cycle that works fine in itself, but I want to add a game clock that works off the initial position of the sun (Directional ...
1
vote
1answer
99 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 ...
0
votes
2answers
35 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 ...
9
votes
2answers
4k views

How do I determine if one polygon completely contains another?

I have 2 polygons. I know the vertex coordinates of both polygons. What's the best way to check if one is completely inside the other? For example, the algorithm should only recognize the black ...
0
votes
2answers
68 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 ...
0
votes
3answers
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 ...
0
votes
1answer
57 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 ...
-1
votes
1answer
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 ...
0
votes
1answer
172 views

How to rotate a triangle towards the point in Qt?

I have an issue with items rotating. I have a point and a triangle which needs to be rotated with its apex point towards the taregt point. The right side of the picture represents how it is should to ...
0
votes
2answers
43 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, ...
-1
votes
2answers
2k views

How does atan2 work when getting angle of a vector?

I know that atan2 gives me the absolute angle of any vector. But it doesn't give a value from 0 to 360 degrees. Instead, it gives a value (if I'm not mistaken), between 0 and 180, or between 0 and -...
0
votes
0answers
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 ...
0
votes
2answers
88 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 ...
1
vote
0answers
90 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 ...