A mathematical concept that can be used to express position, direction or velocity and which can simplify or outright trivialise spatial problems.
6
votes
2answers
330 views
Vector problem: which one is the left / centre / right one?
In aviation, runways are named according to their magnetic orientation seen from the pilot's perspective. For example: a strip of asphalt oriented along the east-west axis will be named 9 for the ...
5
votes
3answers
867 views
Why aren't linked lists more common data structures for enemies?
I was recently listen to a talk that Jonathan Blow gave, you can find it here. In the talk, he was talking about what data structures he (and he seemed to imply many others) use, and why. Which is ...
8
votes
1answer
383 views
Downprojecting an imaginary 4D mesh to the screen
As a mental exercise, I'm trying to imagine projecting an arbitrary 4D mesh onto the screen (2D).
I'm guessing a single 4D triangle would still consist of only 3 points, however each of those 3 ...
12
votes
1answer
2k views
Determine arc-length of a Catmull-Rom spline
I have a path that is defined by a concatenation of Catmull-Rom splines. I use the static method Vector2.CatmullRom in XNA that allows for interpolation between points with a value going from 0 to 1.
...
1
vote
1answer
178 views
Mesh to world vector translation
Suppose I have a world defined in typical OpenGL coords.. then the up vector defined for this space is (0,1,0).
Now, if I load a model that is defined with (0,0,1) as its up vector, what are the ...
4
votes
2answers
1k views
How to calculate the vector of an interception?
Given are a twodimensional space, and 1 friendly spaceship standing still, one foe is moving NOT directly to the friendly ship with known actual position, speed and direction.
The friendly ship wants ...
1
vote
2answers
419 views
Circle collision detection and Vector math: HELP?
Hey so i'm currently going through the wildbunny blog to learn about collision detection, but i'm a bit confused on how the vectors he's talking about come into play
QUOTED BLOG:
p = ||A-B|| – ...
12
votes
5answers
2k views
Do I need the 'w' component in my Vector class?
Assume you're writing matrix code that handles rotation, translation etc for 3d space.
Now the transformation matrices have to be 4x4 to fit the translation component in.
However, you don't actually ...
14
votes
6answers
3k views
Vectors in game development
I'm new to programming and game programming.
I've reading something about vectors and math, but I have a question - where do I use vectors in game programming? Maybe anyone can give a simple example ...
5
votes
2answers
432 views
Collision Detection/Response in Vector-based levels
I have a 2D side scroller whose levels are stored as vectors (that is, a bunch of lines) which looks like this:
How would I detect that I'm colliding with one of these lines, and react accordingly ...
5
votes
1answer
961 views
Rotate object to face player
This is probably a simple vector question, but I'm not sure how to do it.
I have an object at vector position (ox,oy). Potentially every update, the user walks around the screen, and will be at ...
7
votes
3answers
1k views
Rotating a vector by another vector in shader
I have a terrain surface with a normal for each point on the terrain.
I have a second detail normal map to be applied to the terrain.
These normals are in 3-space.
The Y value of both normals is
...
5
votes
3answers
606 views
Should we go for our Vector2Int/Vector3Int implementation or just use built-in float based vectors?
So in one of our projects we're using Vector2/Vector3's a lot but we do only use integer/byte values mostly. So up to the point we've implemented our Vector2Int, Vector3Int, Vector2Byte and so ...
2
votes
2answers
377 views
Swapping axis labels between 2D and 3D coordinates
My game world is 3D.
The map is only 2D, however.
It is natural to think of the map as having an X and Y axis.
And it is natural to think of the world has having an X, Y and Z axis, where Y is ...
9
votes
4answers
349 views
What exactly causes a surface to overlap another?
I cannot really figure out what causes one surface to overlap another. In a 3D engine I'm creating, my technique is failing in edge cases.
My method is sorting the surfaces to be painted from the ...
2
votes
1answer
365 views
Calculating camera zoom value (top-down)
I need some help in 'camera maths'. I have a birds eye view of two characters. One character is static and the other can move. I would like the camera to always show both characters in full and, in ...
1
vote
3answers
465 views
Get intersection of vector in the middle of the screen
My screen resolution is 640x480 and I have two Vector2 objects located at (10,10) and (600, 320).
How can I connect these two objects and extend the line to encompass the whole screens width, how can ...
7
votes
4answers
619 views
Moving objects colliding when using unalligned collision avoidance (steering)
I'm having trouble with unaligned collision avoidance for what I think is a rare case. I have set two objects to move towards each other but with a slight offset, so one of the objects is moving ...
3
votes
1answer
819 views
Points on lines where the two lines are the closest together
I'm trying to find the points on two lines where the two lines are the closest. I've implemented the following method (Points and Vectors are as you'd expect, and a Line consists of a Point on the ...
2
votes
1answer
428 views
Calculate the initial velocity of a 3D trajectory
I've got a 2D projectile code sample working, but would like to extend it to 3D. How would I calculate the initial velocity of the Z-axis? At the moment, I've got:
initVel.X = (float)Math.Cos(45.0);
...
3
votes
3answers
291 views
Adding 'swerve' to a direction
I'm not much of a maths expert, so this is probably quite straight forward. I was playing a soccer flash game where you take free kicks. You provide Power, Swerve and Direction. I'm reading up on ...
2
votes
1answer
2k views
2d tank movement and turret solution
I'm making a simple top-down tank game on the ipad where the user controls the movement of the tank with the left "joystick" and the rotation of the turret with the right one. I've spent several hours ...
2
votes
2answers
1k views
Weird rotation problem
I'm creating a simple tank game. No matter what I do, the turret keeps facing the target with it's side. I just can't figure out how to turn it 90 degrees in Y once so it faces it correctly. I've ...
2
votes
1answer
3k views
Adding 2D vector movement with rotation applied
I am trying to apply a slight sine wave movement to objects that float around the screen to make them a little more interesting. I would like to apply this to the objects so that they oscillate from ...
6
votes
2answers
11k views
Moving a sprite in XNA/C#, using vectors
I'm currently looking into XNA game development with the C# language.
I have two classes: the main game handler and a "sprite" class. Following is some basic pseudo-code which I hope adequately ...
12
votes
4answers
8k views
How can I calculate the angle 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 ...
1
vote
1answer
260 views
Determining relative velocities on impact?
I'm trying to figure out a way to determine the relative velocity of a body colliding with another in a 2D environment.
For example if one body is moving at (1,0) and another traveling behind it ...
3
votes
2answers
6k views
Rotate vector by matrix?
If I have a Vector, say (1,1), how can I rotate it around the origin (0,0)?
I'm working in XNA if that helps.
3
votes
1answer
2k views
How do I find rotation in 3D based on a vector/normal?
I've been playing with Blender and Python, doing basic things like accessing vertices/normals,etc.
I can get the normal of each face of a mesh. I was wondering, how can I get the rotation of a face ...
3
votes
2answers
288 views
How do you transform a vector to use another objects orientation?
I want to take a vector that is using world coordinates and position it using the orientation of an object. So, if the direction of the object is the z-axis, and the vector is (0,0,1), then the ...
3
votes
4answers
2k views
Line triangle intersection - last bits
I'm doing line-triangle intersection. I have found the intersection point (vector) on the plane. All I need to do now is work out whether the point is inside the triangle it collided with (not the ...
3
votes
3answers
280 views
When to return a reference and when to return a copy?
I was looking at the d3dx math .h and noticed that a difference between the "+" and "+=" operators:
D3DXVECTOR3& operator += ( CONST D3DXVECTOR3& );
D3DXVECTOR3 operator + ( CONST ...
6
votes
2answers
909 views
For a 2D XNA game, should I use the built in Vector2 or Vector3 or port my own class from ActionScript?
I use a lot of 2D vectors in my Flash games - basically all velocities, positions etc I store in this way. My Vector2D class has lots of built in functions for rotation, dotproduct, projectOnto etc. ...