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

4
votes
1answer
525 views

Why game engines usually don't offer a vector3.rotate method? [closed]

Game engines like Three.js, Ogre3d and Unity3d often don't provide a default rotate method on their vector class. You usually have to do something like: rotated = vector.applyQuaternion( new ...
10
votes
3answers
6k views

What are normal, tangent and binormal vectors and how are they used?

I would like to find out the following information: What are they? Example usage in game development (the area they are used in) About the following vector types: Normal Tangent Binormal A ...
1
vote
0answers
106 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 ...
3
votes
3answers
2k views

Getting correct angles between Vector3s

I'm working on a project where you can draw lines between points. You select one point and drag the mouse onto another point and a line is drawn between them. The line itself is a 3d object which is ...
5
votes
1answer
462 views

Rotating plane to be parallel to given normal via change of basis

I have two planes and their respective normals. I would like to rotate the second plane, planeB, so that it is parallel to the first, planeA. To do this, I am using a change of basis to rotate each ...
2
votes
2answers
382 views

Why does handedness matter at all?

I'm really trying to understand this from a mathematical viewpoint. After all, numbers are numbers, the chirality or handedness depends on how one interprets it. Say I've three basis vectors x (1, 0, ...
0
votes
1answer
75 views

How to change Vectors due to change in it's dependent Base Vector?

PLOT : I have been developing a game where the player falls down on Y axis and the camera is a Top-Down view camera. The camera, player (main character in the game) movements etc. have all been ...
0
votes
1answer
188 views

Character movement relative to cursor position

I want my top-down shooter character to move towards the mouse when pressing the up arrow and strafe relative at right angles to it when pressing the left and right arrow keys. I can't figure out how ...
1
vote
1answer
118 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 ...
2
votes
1answer
400 views

Shooting Bullets Around a Sphere

I currently have a ship that can orbit around a sphere freely controlled by a joystick. There is a separate joystick that controls the gun and starts shooting when it is touched. Right now the ...
8
votes
7answers
2k views

What's the best way of transforming a 2D vector into the closest 8-way compass direction?

If you have a 2D vector expressed as x and y, what's a good way of transforming that into the closest compass direction? e.g. x:+1, y:+1 => NE x:0, y:+3 => N x:+10, y:-2 => E // ...
0
votes
3answers
1k 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
1k 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
217 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
686 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
157 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
182 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
207 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
437 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
67 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
2k 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 ...
0
votes
3answers
3k 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, ...
2
votes
2answers
937 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
1k 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
2k 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
2k 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
230 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
689 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 = ...
2
votes
2answers
1k 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
408 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
394 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
235 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
395 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
103 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
268 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
631 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
463 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 ...
5
votes
1answer
3k 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
661 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
177 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
154 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
276 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
649 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
209 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
178 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
339 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
898 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
1k 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
261 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
358 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 ...