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

0
votes
2answers
401 views

3D Vector “End Point” Calculation for procedural Vector Graphics

Alright, So I need some help with some Vector Math. I've developing some game Engines that have Procedural Fractal Generation for Some Graphics, such as using Lindenmayer Systems for generating Trees ...
3
votes
1answer
349 views

Finding closest object to a location within a specific perpendicular distance to direction vector

I have a location and a direction vector indicating facing, I want to find the closest object to that location that is within some tolerance distance (perpendicular distance) to the ray formed by the ...
2
votes
2answers
171 views

How can I move a polygon edge 1 unit away from the center?

Let's say I have a polygon class that is represented by a list of vector classes as vertices, like so: var Vector = function(x, y) { this.x = x; this.y = y; }, Polygon = function(vectors) { ...
0
votes
1answer
295 views

C++ and SDL Trouble Creating a STL Vector of a Game Object

I am trying to create a Space Invaders clone using C++ and SDL. The problem I am having is in trying to create Waves of Enemies. I am trying to model this by making my Waves a vector of 8 Enemy ...
2
votes
1answer
316 views

Detect if square in grid is within a diamond shape

So I have a game in which basically everything is a square inside a big grid. It's easy to check if a square is inside a box whose center is another square: *** x *o* --> x is not in o's ...
1
vote
0answers
284 views

Calculate initial velocity of a 3d vector-based projectile

Okay, so I got a Projectile with 2 Vectors, position and velocity. I now want to calculate the initial velocity for it in order to reach a specific point on the map. Or actually, how high has the ...
5
votes
3answers
1k views

Split a 2D scene in layers or have a z coordinate

I am in the process of writing a 2D game engine, and a dilemma emerged. Let me explain the situation... I have a Scene class, to which various objects can be added (Drawable, ParticleEmitter, ...
2
votes
1answer
293 views

Transform 3D vectors between coordinate systems

I've got 6 points in 3D space: A,B,C,D,E,F, that represent 4 vectors. AB is perpendicular to AC and DE is perpendicular to DF. I need to find a transformation matrix M, that transforms AB to DE and ...
-2
votes
2answers
459 views

Calc direction vector based on destination vector and distance from enemy in AS3

I'm working on a zombie game in AS3 where I want a character to be able to move away from a zombie depending upon how close the zombie is. The character also has a destination that it's trying to get ...
1
vote
1answer
482 views

Trouble with SAT style vector projection in C#/XNA

Simply put I'm having a hard time working out how to work with XNA's Vector2 types while maintaining spatial considerations. I'm working with separating axis theorem and trying to project vectors onto ...
1
vote
1answer
470 views

Transform 3d viewport vector to 2d vector

I am playing around with 3d transformations and came along an issue. I have a 3d vector already within the viewport and need to transform it to a 2d vector. (let's say my screen is 10x10) Does that ...
2
votes
2answers
1k views

Smooth vector based jump

I started working on Wolfire's mathematics tutorials. I got the jumping working well using a step by step system, where you press a button and the cube moves to the next point on the jumping curve. ...
0
votes
1answer
379 views

Vector reflect problem

I'm testing some vector reflection and I want to check what happens when a ball collides with a paddle. So if I have: Vector2 velocity = new Vector2(-5, 2); position_ball += velocity; if ...
1
vote
1answer
843 views

Interpolation between two 3D points?

I'm working with some splines which define a path a character follows (you can see a gameplay video here to get a better understanding of what's going on: http://www.youtube.com/watch?v=BndobjOiZ6g). ...
8
votes
2answers
2k 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
583 views

Rotate point by a direction vector

Given a vector, A, which represents a point, and a unit vector, B, which represents the looking direction, how would I rotate A so that B is the axis that's looked down on? Let's say the looking-axis ...
2
votes
1answer
253 views

Moving Unit Parallel to Mouse in TBS Game

I'm writing a basic Turn-Based Strategy game using Unity3D. It's not grid-based. I've come to the point where I'm coding unit movement, and I'm having trouble figuring out how far to move the units ...
0
votes
1answer
530 views

Determining and culling non-visible vertices

Ahoy! After posting my previous question on tile maps, i've been tinkering with an implementation i'm rather pleased with so far but would like to gather some more information about submitting ...
-1
votes
1answer
157 views

Find a Rectangle by coordinates - XNA

I have 2 coordinates (X,Y). I have also a 10x10 array. By these coordinates I have to find the rectangle in which is my pointer at the moment. How could I handle it?
3
votes
4answers
2k views

Most effective way to manage a gamestate system that is easy to use?

I just started working on my game, mostly the game management. I plan and using game-states to make the menu's and other stuff easier. My main idea for implementing the game-states is creating a game ...
0
votes
3answers
304 views

How would I successfully split a vector to increase game performance?

Okay so I have a vector for all of the monsters that are spawned in my game. All of these monsters are in a single vector and are "active" according to what zone they are in relative to the player's ...
2
votes
1answer
335 views

multiply matrix by vector: what to do if need to change y-up to z-up?

I multiply a matrix with a position vector to get a new position, however, now I need to change my matrix from y-up coordinate space to z-up. Changing only the matrix won't work: how to apply the ...
3
votes
1answer
1k views

Make objects follow a strict path (Xna)

I am making a defence game. Naturally, this means that there needs to be objects following a path on the screen. I want to make it a strict path from one point to another to another. I could use an ...
7
votes
2answers
3k views

How do I find the angle between two vectors?

I have 3 points on my screen: a = a point which is (c.x, 0) makes a line pointing straight up b = a user input touch, can be anywhere on the screen c = a moving object a _______.________ | ...
2
votes
1answer
691 views

Rotating a vector by a quaternion

I am trying to rotate a direction vector (0,0,1,0) by a rotation quaternion in DirectX. From what understanding, to rotate the vector you must do NewVector = rotQuaternion * Vector * ...
4
votes
1answer
551 views

How do I determine the position of one vector relative to another?

I'm making a game for Kinect in Unity which tracks hand movements. I have the player's root position and the position of their fist stored as 3-dimensional vectors (Vector3 in Unity), but they're both ...
0
votes
1answer
3k views

The normal vector to a plane ax+by+cz+d=0?

I am calculating the normal vector to a plane ax+by+cz+d=0 According to the book: The normal vector N is often normalized to unit length because in that case the equation d = N ⋅Q + D gives the ...
0
votes
2answers
160 views

How do I make a vector exactly reach a line?

Let's say a vector starts at Point P and points in the direction of v. How do I make sure that this vector exactly reaches the line? Its end should be exactly on the line, and not cross it.
1
vote
4answers
189 views

Vectors and corners of squares

I am having some problems with some vector math. Imagine a square and coming from each corner of the square is an invisible vector, which starts at the square's centre and ends at the edge of the ...
-1
votes
2answers
197 views

How to make sure that a Point A moving in the direction V reaches at Point B?

Let say I have, Point A(X1,Y1) moving in the direction V(W, H). I need to make sure that it reaches B(X2,Y2). I think I need to subtract some value in Point A(X1, X2). But not know what? I also sure ...
-1
votes
1answer
303 views

std::vector::size with glDrawElements crashes?

( win32 / OpenGL 3.3 / GLSL 330 ) I decided after a long time of trying to do a graphical user interface using just opengl graphics to go back to a gui toolkit and so in the process have had to port ...
2
votes
1answer
175 views

Calculate the direction, From Outer Polygon Point to Inner Polygon inside Point

I was able to find the co-ordinates of inner Polygon using this trick. Need the co-ordinates of innerPolygon But, I have some problem in getting the direction from Outer Polygon Point to Inner ...
3
votes
2answers
90 views

Need the co-ordinates of innerPolygon

Let say I have this diagram, Given that i have all the co-ordinates of outer polygon and the distance between inner and outer polygon is d is also given. How to calculate the inner polygon ...
1
vote
2answers
2k views

Calculating the 2D edge normals of a triangle

What's a reliable way to calculate a 2D normal vector for each edge of a triangle, so that each normal is pointing outwards from the triangle? To clarify, given any triangle - for each edge (e.g ...
0
votes
2answers
473 views

Collision: Vector class (java)

When handling collision detection / response and you need a Vector class, do you need to create that class yourself or is there a java class you can use? A vector class should have methods like: ...
5
votes
1answer
235 views

Trouble with speed and vectors

I'm working on adding bullets to my game. Right now I can shoot bullets in the direction that I would like from a ship by getting the ship's angle: int speed = 5; int dx = ...
5
votes
1answer
464 views

How can I calculate a vertex normal for a hard edge?

Here is a picture of a lovely polygon: Circled is a vertex, and numbered are its adjacent faces. I have calculated the normals of those faces as such (not yet normalized, 0-indexed): Vertex 1 ...
4
votes
2answers
3k views

Drawing a texture line between two vectors in XNA WP7

I want to create a simple graph maker in WP7. The goal is to draw a texture line between two vectors what the user defines with touch. I already made the rotation, and it is working, but not ...
1
vote
1answer
157 views

Moving in an arc using Vector3

I'm trying to get this object to move right across the screen until it gets close to the center and arc down smoothly into a straight downward movement. Here's what I've tried: if (position.X < ...
0
votes
1answer
409 views

Calculate path of laser beam?

Lets say we have a laser beam emitter that has a position and an angle (in a 2D world to simplify things). The laser emitted from that emitter will start at that position, and continue heading in the ...
1
vote
1answer
326 views

How to prevent 2D camera rotation if it would violate the bounds of the camera?

I'm working on a Camera class and I have a rectangle field named Bounds that determines the bounds of the camera. I have it working for zooming and moving the camera so that the camera cannot exit its ...
7
votes
1answer
2k views

How do I calculate collision response between a sphere and a plane?

I'm trying to create a simple 3D game and need to constrain the player within the limits of the game world. When the player hits the sides of the world I want the player's ship to bounce off slightly. ...
5
votes
2answers
652 views

Calculate vector in local space

I have a vector (8,5). It's origin is at (10,9) I can calculate a perpendicular like so: MyPerpendicularVector.x = -MyVector.y MyPerpendicularVector.y = MyVector.x Given that I now know these two ...
2
votes
3answers
3k views

Get points on a line between two points

I'm making a simple space game in JavaScript, but now I've hit a wall regarding vectors. The game view is top-down on a 2d grid. When the user clicks on the grid, the space ship will fly to that ...
2
votes
1answer
340 views

How do you extract a Vector3 positions only from a world matrix in an array of positions (from Kinect)

've just started building a physical camera class for the depth data you get from a Kinect. I have a Vector3 array of [imageWidth, imageHeight] describing the LOCAL positions I get in from the kinect ...
4
votes
1answer
2k views

How to Calculate the Contact Point between Ray and Plane

Is there any quick way to find the intersection point between Plane and Ray?
3
votes
1answer
373 views

Confused about order of operation when using a Matrix in XNA, C#

Here are two different pieces of code This is what I started with Vector2 hold = Vector2.Transform(pos1, mat1); Matrix inv = Matrix.Invert(mat2); Vector2 pos2 = Vector2.Transform(hold, inv); And ...
-2
votes
1answer
526 views

Using Vectors for 2d animation [closed]

I've decided that it's best to start using vectors in my games instead of the xPos += xSpeed and yPos += ySpeed approach. I'm posting some of the code from my basic model class which handles movement ...
3
votes
4answers
797 views

Is it better to track rotation with a vector or a float?

In XNA, you can see that to draw a rotated sprite with SpriteBatch, you'll need a float describing the angle in radians. I'm used to making games in OpenGL. I just want a rapid prototyping ...
4
votes
2answers
849 views

What is a good way to determine if a vector is between two other vectors?

I could operate with the angles, but I do not have the angles calculated yet (and would like to avoid having to do that). It would be possible to calculate and cache the local-coordinate-frame angles, ...