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

-2
votes
2answers
479 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
515 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
485 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
412 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 ...
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
664 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
278 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 ...
1
vote
4answers
190 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 ...
0
votes
1answer
712 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
162 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
3k 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
318 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
381 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
4k 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
790 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
599 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
votes
2answers
201 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
340 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
188 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
94 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 ...
5
votes
1answer
241 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
476 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
330 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. ...
1
vote
1answer
160 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 < ...
3
votes
2answers
3k views

Vector images (SVG or other formats) support in libgdx or other Android framework?

I'm looking for a website to create games for Android. I'm interested in something that supports vector images. Do you know if libgdx supports them or is there a convenient way to use them in libgdx? ...
0
votes
1answer
428 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 ...
5
votes
2answers
701 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 ...
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?
2
votes
1answer
369 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 ...
3
votes
1answer
386 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
546 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 ...
6
votes
2answers
416 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 ...
2
votes
4answers
2k views

How to detect if object is moving in clockwise- or counterclockwise direction?

I've read this one, but I need more info: rotating an object from sourceAngle to destAngle, both 0-359, clockwise or counter clockwise? I have a ball. The user is able to drag the ball in any ...
1
vote
1answer
2k views

how to create a Quaternion from an Orientation Vector in xna

i have a Vector3 represents an Orientation in 3D , how to convert it to the corresponding Quaternion ? is there any quick way ? EDIT : i want to add an angular velocity vector to the Orientation ...
1
vote
1answer
272 views

XNA - Incorrect Mouse Ray?

I have the following code: Vector3 nearSource = new Vector3(mState.X, mState.Y, 0.0f); Vector3 farSource = new Vector3(mState.X, mState.Y, 3.0f); Vector3 nearPoint = ...
4
votes
1answer
788 views

Calculating normal vector on a 2d pixelated map

I want to know an efficient way to get the normal of the surface of a 2d map. suppose an object hit the map, i want the object to bounce accordingly. The problem is, the "bounding box" of said object ...
2
votes
2answers
822 views

Why does my sprite jitter when it arrives at its destination?

I have just started looking into XNA for WP7 - and I am definitely the sort of person who likes to find answers to my questions without begging for help! I searched here to find an answer but I found ...
0
votes
1answer
366 views

vector rotations for branches of a 3d tree

I'm attempting to create a 3d tree procedurally. I'm hoping that someone can check my vector rotation maths, as I'm a bit confused. I'm using an l-system (a recursive algorithm for generating ...
2
votes
2answers
416 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 ...
0
votes
1answer
217 views

How can I draw a line rotated some number of degrees away from an original line?

I have a line ahead of my moving object to serve as a raycast and its aligned with the object's movement direction. But I want also some extra lines according to an angle related to the 'head' of the ...
3
votes
4answers
562 views

How to draw a line of a given length towards a given object?

I wanna draw a line between two moving objects I can't use: cDrawLine(startPointCG, endPointCG); because the line must have a length. So I'm trying to measure the angle between those two points ...
6
votes
2answers
1k views

Vector games (Wireframe, Elite-like) theory and implementations?

I'm interesting in knowing more about how vector games like Elite and Star Wars Atari were built from grounds up. The question is not how to implement vector graphics with modern 3D APIs like OpenGL ...