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
3answers
708 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 ...
2
votes
3answers
545 views

Oriented Bounding Box - How to?

I've been trying to write my own collision code, less because I want to, more because I want to understand its working. To do this, i've been working off of the popular collision book i'm sure you've ...
0
votes
4answers
200 views

How much to modify yaw? XNA 4.0 [duplicate]

Heres a picture that explains better than my words can For rotating an object I'm using quaternions. CreateFromAxisAngle(vector3.Right,yaw) Maybe this isn't how I should be doing it but I also ...
8
votes
3answers
558 views

Vector3 vs. Vector2 - performance, usage?

I'm currently playing around with XNA, and creating a simple 2D platformer. I was thinking of adding multiple layers to make it a little bit of challenge. In stead of having a Vector2 for my ...
0
votes
1answer
147 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 ...
1
vote
1answer
150 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, ...
-4
votes
2answers
192 views

enemy shooting towards FPS [closed]

WELL first of all I want you to see my game (its deployed on heroku cloud) : http://still-escarpment-3701.herokuapp.com (It takes almost 10 sec to load so please wait for couple of sec) I have ...
2
votes
1answer
311 views

Min/Max of two vectors?

This seems like a simple question, but i'm having trouble searching the internet for it. In XNA, during a collision detecting method, I would determin the minimum of some vectors. // Get the minimum ...
0
votes
0answers
58 views

Transform a Screen Delta

I have a delta in screen coordinates that I want to transform to a 3d delta in world space. The delta is in this case a movement across the (x,y) coordinates in screen space on the near projection ...
1
vote
1answer
1k 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
votes
3answers
2k views

Scale a normalized 2D vector always to the same length

For any normalized 2D vector, except for ( 0, 0 ), how would I scale the vector to always be the same length? For example: int length = 10; vector v = vector( 0.1, 0.5 ); vector v2 = vector( 0.3, ...
1
vote
2answers
510 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 ...
4
votes
1answer
887 views

Raycasting tutorial / vector math question

I'm checking out this nice raycasting tutorial at http://lodev.org/cgtutor/raycasting.html and have a probably very simple math question. In the DDA algorithm I'm having trouble understanding the ...
2
votes
3answers
1k views

Converting Degrees to X and Y Coordinate change

I am using a float positioning system in my game. IE float x,y,z now I want to get the location of the mouse, then to fire an arrow to it. X0 = the players X location X1 = the mouse X location Y0 = ...
1
vote
2answers
1k 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 ...
0
votes
1answer
162 views

Using NumPy arrays as 2D mathematical vectors?

Right now I'm using lists as position, velocity, and acceleration vectors in my game. Is that a better option than using NumPy's arrays (not the standard library's) as vectors (with float data ...
15
votes
7answers
595 views

Do I need a Point and a Vector object? Or just using a Vector object to represent a Point is ok?

Structuring the components of an engine that I am developing along with a friend (learning purposes), I came to this doubt. Initially we had a Point constructor, like the following: var Point = ...
1
vote
2answers
573 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 ...
0
votes
1answer
306 views

Tilting towards turn direction (for a motorbike)

I have a motorbike which moves along based on a direction vector, I set its forward direction to the direction it's moving. What I'd like to also do with it is have the motorcycle tilt in the ...
1
vote
1answer
325 views

How do I get the axes for SAT collision detection

In SAT collision detection how do I calculate the axes for projection?
2
votes
1answer
209 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 ...
3
votes
2answers
298 views

what does AngleVectors method in quake 3 source code does

I just downloaded quake 3 for learning purposes. I know some of some linear algebra(basic vector math ie: dot,cross product). However I can't decipher what below method does, I know what is yaw,pitch ...
0
votes
1answer
99 views

How to Draw texture between 2 Vector3

My scenario: RTS combat style, 1 unit fires beam on another unit My problem is i want to draw a flat texture between 2 Vector3 points. I have looked at various Billboarding styles but that doesn't ...
2
votes
1answer
237 views

Turning to face mouse

Given three points on the same Y plane; A ship A point along the ships heading A mouse cursor How can I find which direction and angle the mouse cursor is from the ships heading? I have a limited ...
1
vote
1answer
370 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 ...
3
votes
2answers
422 views

3D rotation matrices deform object while rotating

I'm writing a small 3D renderer (using an orthographic projection right now). I've run into some trouble with my 3D rotation matrices. They seem to squeeze my 3D object (a box primitive) at certain ...
4
votes
1answer
2k views

How do I rotate a sprite so that it is 'pointing' in the direction it is moving?

I have a sprite, e.g a missile, heading in a certain direction (using a velocity vector). How do I figure out its how much to rotate it so that it gets drawn 'pointing' in the direction it is ...
1
vote
1answer
529 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) * ...
3
votes
3answers
163 views

Determining a point that reached another point

I have two points, one is moving and one is stationary. I would like to know if the moving point has reached that point or not. I tried to calculate the distance between two vectors and the distance ...
3
votes
1answer
132 views

How to make an object stay relative to another object

In the following example there is a guy and a boat. They have both a position, orientation and velocity. The guy is standing on the shore and would like to board. He changes his position so he is ...
1
vote
2answers
227 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. ...
7
votes
2answers
558 views

Rotate a vector

I want my first-person camera to smoothly change its viewing direction from direction d1 to direction d2. The latter direction is indicated by a target position t2. So far I have implemented a ...
5
votes
1answer
207 views

Moving in a diamond - enemy gets stuck

I have an enemy that I would like to move as follows: Start at (0, 200, 0) Move to (200, 0, 0) Move to (0, -200, 0) Move to (-200, 0, 0) Move to start point, repeat as long as it remains active. ...
-1
votes
4answers
165 views

What is a good starting project to get up to speed with vectors and vector math? [closed]

I have been getting into games programming recently. However, all I have made so far (in order) is Snake, Breakout and Tetris. I want to take on a bigger project, and some research has led me to ...
3
votes
1answer
286 views

How do I implement a selectable world map?

I want to have a selectable map of the world, preferably zoomable, in a cocos2d project. When I tap on a country, I want that country to be selected so that I can perform some other operations with ...
1
vote
1answer
589 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
898 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
1answer
235 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); ...
4
votes
1answer
266 views

Limit rotation heading by cone/angle

What is a fast way of limiting the heading vector to a certain angle so that it turns in greater distance relative to the limit. A smaller cone/angle should make the object take a far bigger curve to ...
2
votes
1answer
360 views

android game-logic for shooter

Im creating a 2d game for android. I'll just get right to it. I have a sprite controlled by a joystick that needs to shoot, sofar Ive managed to get direction and movement on my bullet, but then I ...
0
votes
1answer
130 views

Is it safe to cast my 2D points to 3D points for a library which only takes Vector3s?

I need to cast a ray in 2D space for bullet collision detection, but the Ray.Intersects method requires a BoundingBox which uses vector3's not vector2's. My question is should I just ignore the Z ...
0
votes
2answers
787 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 ...
2
votes
2answers
580 views

android 2d bullet-spawn (shooting)

This will be a quick question since Im pretty sure I'm overlooking something small that I for some reason cant see. My sprite is moved using a joystick, and I want my sprite to be able to shoot. I've ...
1
vote
1answer
442 views

Ball bouncing at a certain angle and efficiency computations [closed]

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 ...
2
votes
1answer
199 views

XNA Framework sprite vectors and also scaling

I'm working on making my first Pong game with XNA Framework 4.0. Right now i've put 2 pong paddles and a ball (they have separate classes). In the "Paddle" class i've made a function that returns a ...
1
vote
1answer
1k 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 ...
3
votes
6answers
2k views

How to implement object velocity as a vector

I'm working on a Breakout game, and want to change the ball's movement code from how I currently do it, to something based on vectors (as I feel learning and implementing movement based on vectors ...
3
votes
1answer
467 views

How to bounce a 2d point particle off of a circular edge

In a prototype I'm building, a particle can spawn anywhere within a larger, confining circle. Important to note is that the particle will not spawn in the origin of the larger circle, but anywhere ...
3
votes
5answers
1k views

Normalization of Vectors: Return a copy of the result or alter the object itself?

When calculating the normal of a vector, which is considered canon: Returning a copy: Vector2D Vector2D::Normalize() const { double a1 = GetX(); double a2 = GetY(); double a3 = GetZ(); ...
0
votes
3answers
314 views

Parent-Child position mathematics

What is the math theory when a child object moves with the parent transform? I am doing an angle indicator which shows a field of view, which works fantastic when the angle is static. But I cannot ...