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

3
votes
1answer
1k views

Bukkit shoot tnt & help with vectors

I want to shoot a piece of tnt from the players face and then let it explode when it hits the target block. if (cmd.getName().equalsIgnoreCase("cannon")) { ...
1
vote
1answer
259 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 = ...
3
votes
1answer
738 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
749 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
352 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 ...
21
votes
2answers
1k views

Calculating the rotational force of a 2D sprite

I am wondering if someone has an elegant way of calculating the following scenario. I have an object of (n) number of squares, random shapes, but we will pretend they are all rectangles. We are ...
0
votes
1answer
211 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
542 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 ...
2
votes
3answers
1k views

Check if the vector is behind another or maybe opposite directions?

I'm doing a network game and on the client side, i interpolate the client position with the server sent extrapolated position. The client has its own physics simulation wich is corrected by the server ...
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 ...
3
votes
2answers
3k views

Is there a good cross-platform C++ vector graphics library out there?

I'm making a game and want to use vector graphics. I started re-coding it using Cairo and the performance is horrific. So, I'm looking for a different library. It needs to be for C++ and ...
1
vote
1answer
122 views

How should I update vectors, et cetera, in a time-based fashion?

I'm trying to write something I believe is straightforward but wanted to check that I'm doing it right. All I want is to update the position of a 2D sprite based an acceleration and velocity. I'm ...
2
votes
1answer
275 views

What is wrong with my technique for transmitting server and client game state?

I'm doing a network implementation of a fast-paced game. I have a puck on bot the server and client side of the simulation. I want to update the client puck position only if they are on the same ...
9
votes
2answers
5k views

How do I linearly interpolate between two vectors?

I have a velocity vector where my client is at and where its going, and I have the same vector that comes from the server telling where the client should be. Sometimes its a bit different, so I want ...
2
votes
2answers
670 views

How to calculate vector that is perpendicular to the direction of moving in Flash?

In flash i have a class that extends movieclip and i am moving it forward, up and down, and rotating it. How can i calculate the vector that is perpendicular to this movieclip?
11
votes
2answers
454 views

How do I find a point on a line?

I have two points (A, B) and the length of d. How can I find point C?
3
votes
1answer
299 views

Vector fields and game engine

It exist a game developed with a vectorfield game engine? What I mean is that instead of calculating intersections, one could calculate the vector field generated for example by gravity, and for ...
1
vote
1answer
625 views

How do I get the vertical angle between 2 vectors?

So I'm modding a 3D game, my goal is to place a label on the screen pointing to the unit's direction. I'm getting the horizontal angle by projecting these vectors in a plane, like this: private ...
1
vote
1answer
233 views

What can I use to generate 2d vector graphics as a list of coordinates?

I am working on a game that uses simple 2d vector graphics. I want a tool that will let me visually draw things like arbitrary polygons by placing points. A perfect tool would present a grid that I ...
6
votes
2answers
401 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
1k 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
467 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 ...
14
votes
1answer
3k 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
195 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 ...
7
votes
2answers
2k 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
462 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|| – ...
14
votes
5answers
4k 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 ...
16
votes
6answers
4k 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 ...
6
votes
2answers
487 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
1k 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
2k 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
701 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
409 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
369 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
445 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
505 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 ...
8
votes
4answers
762 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 ...
4
votes
1answer
1k 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
474 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
313 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
3k 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
2k 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
4k 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 ...
8
votes
2answers
14k 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 ...
17
votes
4answers
11k views

How can I calculate the angle and proper turn direction 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
269 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
7k 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.
4
votes
1answer
3k 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
300 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
3k 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 ...