A mathematical concept that can be used to express position, direction or velocity and which can simplify or outright trivialise spatial problems.
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
1answer
56 views
front and back face detection
I am trying to implement a dynamic shadow system for a 2d game using this tutorial :
...
2
votes
1answer
166 views
How to shift a vector based on the rotation of another vector?
I’m learning 2D programming, so excuse my approximations, and please, don’t hesitate to correct me. I am just trying to fire a bullet from a player. I’m using HTML canvas (top left origin).
Here is a ...
2
votes
1answer
213 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
1answer
258 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 ...
2
votes
1answer
362 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 ...
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
2answers
100 views
Relative cam movement and momentum on arbitrary surface
I have been working on a game for quite long, think sonic classic physics in 3D or tony hawk psx, with unity3D. However I'm stuck at the most fundamental aspect of movement.
The requirement is that I ...
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 ...
1
vote
1answer
185 views
How to get a point to the left/right of a vector
I have a position vector of a point in space and a quaternion for it's rotation. What i'm trying to calculate is a point too the left and a point to the right.
I have the position and ...
1
vote
1answer
273 views
Understanding math used to determine if vector is clockwise / counterclockwise from your vector
I'm reading Programming Game AI by Example by Mat Buckland. In the Math & Physics primer chapter there's a listing of the declaration of a class used to represent 2D vectors.
This class contains ...
1
vote
2answers
178 views
convert orientation vec3 to a rotation matrix
I've got a normalized vec3 that represents an orientation.
Each frame of animation, an object's orientation changes slightly, so I add a delta vector to the orientation vector and then normalize to ...
1
vote
2answers
582 views
Line Intersection from parametric equation
I'm sure this question has been asked before. However, I'm trying to connect the dots by translating an equation on paper into an actual function. I thought It would be interesting to ask here instead ...
1
vote
2answers
998 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 ...
1
vote
2answers
116 views
Determining if something is on the right or left side of an object?
I have a character in a 3D world which is facing an arbitrary direction on a flat plane, the player can click on the left or right side of the character and based on which side is clicked on a ...
1
vote
1answer
457 views
Rotate triangle so that its tip points in the direction of the point on the screen that we last touched
OpenGL ES - Android.
Hello all, I am unable to rotate the triangle accordingly in such a way that its tip always points to my finger.
What i did : Constructed a triangle in by GL.GL_TRIANGLES. Added ...
1
vote
1answer
575 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
87 views
Confusing with an articles wording on Clamping a Vector2
I have been reading an article on Collision Detection and how to resolve it.
http://www.wildbunny.co.uk/blog/2011/04/20/collision-detection-for-dummies/
In the section describing an AABB vs Circle, ...
1
vote
1answer
457 views
Unity: parallel vectors and cross product, how to compare vectors
I read this post explaining a method to understand if the angle between 2 given vectors and the normal to the plane described by them, is clockwise or anticlockwise:
public static AngleDir ...
1
vote
4answers
179 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
vote
1answer
1k 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
3answers
464 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 ...
1
vote
1answer
336 views
how can i get rotation vector from matrix4x4 in xna?
i want to get rotation vector from matrix to realize some parent-children system for models.
Matrix bonePos = link.Bone.Transform * World;
Matrix m = Matrix.CreateTranslation(link.Offset)
* ...
1
vote
1answer
182 views
Viewport.Unproject - Checking if a model intersects a large sprite
Let's say I have a sprite, drawn like this:
spriteBatch.Draw(levelCannons[i].texture, levelCannons[i].position, null, alpha, levelCannons[i].rotation, Vector2.Zero, scale, SpriteEffects.None, 0);
...
1
vote
1answer
748 views
Vector movement in space type game (Mouse rotation)
I'm having an issue with my movement in my 'game' prototype. It's basically not working and admittedly my knowledge with vectors is lacking.
The issue I'm running into is that the ship won't move in ...
1
vote
1answer
312 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
602 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). ...
1
vote
1answer
139 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 < ...
1
vote
1answer
220 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 = ...
1
vote
1answer
117 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 ...
1
vote
1answer
206 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 ...
1
vote
2answers
418 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|| – ...
1
vote
1answer
92 views
Movement constrained to the faces of a cube
The basic setup I'm working with is a cube rendered in-Engine (Panda3d, although I only am looking for a generalized solution) as well as a 2d square on one face of the cube. The eventual outcome I'm ...
1
vote
1answer
148 views
How do I get the axes for SAT collision detection
In SAT collision detection how do I calculate the axes for projection?
1
vote
2answers
147 views
Billboarding + aligning with velocity direction
I'm working on a particle system where I'm orientating the billboard using the inverted orientation matrix of my camera. This works quite well and my quad are rotated correctly towards the camera.
...
1
vote
1answer
396 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 ...
1
vote
1answer
286 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 ...
1
vote
1answer
549 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
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 ...
1
vote
0answers
60 views
Rotate Points with Object in world space
I posted this in the original stack overflow then realized that a game-dev specific one exists.
I am working on personal project that requires me to have 4 points surrounding an object (1 at each of ...
1
vote
1answer
270 views
Ball bouncing at a certain angle and efficiency computations
I would like to make a pong game with a small twist (for now).
Every time the ball bounces off one of the paddles i want it to be under a certain angle (between a min and a max). I simply can't ...
1
vote
0answers
243 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 ...
0
votes
1answer
1k 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.
0
votes
1answer
249 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 ...
0
votes
1answer
260 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 ...
0
votes
2answers
140 views
Asteroids Movement
I have been making an asteroids clone, in C#. However, the ship's movement is... not quite right.
My plan is this: there is a speed, and two directions, namely the direction the ship is facing ...
0
votes
3answers
250 views
Lerp vs Vector math: one better than the other?
In Unity3D (all versions, I believe), there is a static function for the Vector3D class called "lerp". It interpolates a point between two points a point, based off a provided percentage related to ...
0
votes
1answer
117 views
Vector2's static methods and the garbage collector
I discovered that Vector2's static methods return a different Vector2 from the parameters you give them and I'm under the impression that creating new objects and dereferencing old ones on this kind ...
0
votes
2answers
476 views
Calculating angle between two vectors to steer towards a target
I have been trying to implement a path following steering behaviour for AI in a 2D racing game.
I have two vectors:
futurePosition represents the predicted future position given the car's current ...


