A mathematical concept that can be used to express position, direction or velocity and which can simplify or outright trivialise spatial problems.
1
vote
4answers
59 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 ...
0
votes
1answer
40 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
1answer
37 views
Given a rotated transform, get normalized (proper up, front) version
I am working on a game where you roll a wheel down the track. Now I am looking to implement a feature, where you could turn it left and right, but I cannot get the proper vectors through which to ...
3
votes
4answers
95 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 ...
1
vote
1answer
31 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
2answers
90 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 ...
-2
votes
1answer
16 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
40 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
32 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 ...
1
vote
2answers
28 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
64 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
61 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, ...
1
vote
1answer
73 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
3answers
167 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 ...
0
votes
2answers
32 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 ...
0
votes
2answers
61 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
45 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 ...
-1
votes
1answer
41 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
46 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 ...
0
votes
1answer
132 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
2answers
39 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, ...
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 ...
1
vote
0answers
68 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 ...
0
votes
2answers
76 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 ...
3
votes
2answers
130 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 ...
1
vote
0answers
24 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 ...
1
vote
1answer
48 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 ...
6
votes
2answers
186 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 ...
0
votes
2answers
64 views
How to convert velocity (Vector) to m/s (Scalar)
I have a variable called velocity which I get from a dynamic body in Box2D. It is the velocity of a pirate ship and when I add torque to the ship I want that to be proportional to the speed (m/s - ...
1
vote
1answer
46 views
Should I store local forward/right/up vector or calculate when necessary?
I'm working on an object picking and translation/rotation/scale gizmos system in my engine where you select objects and perform transformations on them in a 3d editor-like fashion (e.g. Blender)
In ...
0
votes
1answer
128 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 ...
-2
votes
1answer
48 views
how to set in vector float x y coordinates [closed]
i am use eclipse java android i am try to projectile trajectory in my game like angry birds example here ...
0
votes
0answers
62 views
How to get the angle an object is travelling at
I'm trying to figure out how to get the angle an object is moving at, but have ran into a few problems. My player object is moved by rotating the entity left and right by using the left and right ...
1
vote
1answer
42 views
Vector out of range (Batch rendering & opengl)
So ive (tried to) implement a batch rendering system, and at the for loop the error pops up and I'm not shure what ive done wrong. Any suggestions to improve the system would be much appreciated. ...
2
votes
1answer
90 views
Ball's velocity vector, reflect against a point
I need to calculate the new velocity vector when the ball collides with one of the paddle's corners.
Let d be the velocity vector of the ball,
r the target velocity vector
and n the surface normal ...
1
vote
1answer
79 views
How to calculate a vector for multi-axis rotations from sphere coordinates?
I'm working on a SceneKit project in iOS, trying to rotate a sphere (representing a planet) so that a point at a given longitude/latitude coordinate is facing "forward" (i.e. that point moves to the ...
2
votes
1answer
62 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 ...
4
votes
2answers
181 views
Movement with Vector Math
After reading This SO post on Vectors, I'm still pretty confused on how to use vectors to move my entities at any angle. The SO post assumes only 90 degree angles:
if up pressed:
direction = ...
1
vote
1answer
82 views
How to make an enemy projectile head to the player's position with constant speed
How can I dynamically set the movement speed of the X and Y of the projectile so that it moves at a constant speed when the projectile heads at the player's position? I know this has something to do ...
3
votes
4answers
101 views
Intersection of a Line and a Rectangle
I have to calculate the intersection of a line segment (represented by 2 points) with a rectangle.
For example:
Axis aligned rectangle corners: (0, 0) (100, 100)
Point 1: (50, 50)
Point 2: (50, ...
-1
votes
1answer
59 views
Moving vector shooting at other moving vector
The following code creates an accurate shot to be made at a moving target from a stationary position. (ie a tower or non-moving vector). It works GREAT, but I need it to consider the movement of the ...
2
votes
0answers
31 views
Weird warping with per-vertex normals
I've had this little problem for a while now, where for some reason my calculations for per-vertex normals results in a weird distortion or warping, skewing my lighting, shading, and reflection ...
2
votes
1answer
65 views
How do I create a rocket projectile that is “dropped”, then accelerates toward the enemy?
I'm making an Asteroids-like game. I've successfully implemented linear bullets.
Now I want to add some rocket-styled bullets, with a certain flight path:
The rockets should be "dropped" back first, ...
1
vote
1answer
49 views
How to find if an object is facing another object given position and direction as separate vectors
I found a very helpful post about exactly what I need here. It uses dot products to which is what I'm specifically looking for.
It talks about players facing monsters basically. They give a helpful ...
1
vote
2answers
85 views
Calculating the vector to catch a falling object
I have two objects in a three dimensional world. One is a ballistic projectile: that is, it is free-falling with some known gravitational acceleration. The other is a catcher that travels with ...
0
votes
1answer
49 views
In unity, how do I rotate a vector in relation to the player?
I am making a radar script in a unity FPS game project I am making for class. I already have a working example of a radar script that works in relation to the player's position. However the rotation ...
1
vote
1answer
69 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
1answer
217 views
Unity3d - Transform rotation(angle) help
Im trying to rotate an object 90 degrees to the left but instead of rotating straight left it rotates 270 degrees to the right.
Here's the part of the code which controls the rotation:
...
1
vote
2answers
73 views
Clamp view direction vector to nearest axis
In JMonkeyEngine, given any view direction Vector3f instance, I'd like to get a new vector facing the nearest x or z axis (positive or negative), with y set to 0.
For example
[-0.99915564, ...
0
votes
1answer
44 views
Camera will not move between given points, stuck at first given point
[EDIT: Working code added]
[Original question]
I'm putting together a "raid cam" or "overview cam" for a given map in my shooter for an observing player to use to fly down a given preset path (to ...