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
2answers
167 views

Finding vectors with two points

We're are trying to get the direction of a projectile but we can't find out how For example: [1,1] will go SE [1,-1] will go NE [-1,-1] will go NW and [-1,1] will go SW we need an equation of ...
1
vote
1answer
190 views

When to use an Array vs When to use a Vector, when dealing with GameObjects?

I understand that from other answers, Arrays and Vectors are the best choices. Many on SE claim that Linked Lists and Maps are bad for video game programming. I understand that for the most part, I ...
2
votes
0answers
208 views

Quaternion to direction vector - flipping

I've kinda solved this myself by adapting the Camera::setDirection code from OGRE to work for my need: Now I have the following code: Vector3 boneDir = getBoneWorldOrientation(mEntity, mHips) * ...
-1
votes
2answers
371 views

XNA Creating a directional vector from two other vectors

Could somebody please tell me what I'm missing? I have a scene where the camera is fixed in the sky looking down on a plane. On that plane is a 3D model. I want to move the 3D model in the direction ...
10
votes
4answers
968 views

How does normal mapping really work?

I'm trying to grasp the concept of normal mapping, but I'm confused by a few things. In short, I'm not sure whether a normal map is viewpoint dependent or not (i.e. whether you'll get a different ...
1
vote
2answers
766 views

Libgdx: Am I abusing Vector2? Is there a better way to do my position updates and rendering?

I'm simulating hair in a game. Currently I have a HairField object, which has a position defined by a Vector2. Each HairField has multiple Hair objects in a list, each with a position defined by a ...
0
votes
1answer
88 views

Rotating sprites

I'm a beginner at making games, i'm currently only working in 2D using XNA. So far all of my games i've been using the following logic for sprite movement: if(left key pressed) sprite_x_position ...
3
votes
4answers
2k views

How to smoothly rotate a vector in a direction?

I'm looking for an easy way to achieve the following: Object A, B { Vector2D position; Vector2D orientation; } update(elapsed) { //rotate A's orientation in B's direction by x * elapsed ...
0
votes
1answer
216 views

Sharp DX Identity Matrix, Matrix.Forward vector pointing at negative Z

I'm trying to take a steady grip on Sharp DX. Already done some work like translating, scaling and rotating objects. Now i have to calculate the rotation matrix using only direction vector and ...
-1
votes
1answer
115 views

Optimization of Storage of Spells a Character Knows

I need to store which spells a character knows. While the game is executing I have them stored in a vector. Obviously storing this many values is either going to take a lot of computing to get the ...
8
votes
3answers
581 views

Collision detection problems using AABB's

I implemented a simple collision detection routine using AABB's between my main game sprite and various platforms (Please see code below). It works great, but I'm now introducing gravity to make my ...
-1
votes
2answers
134 views

JavaScript “Floats”, or ThreeJS wrong positioning? [closed]

I want to learn how to use Vectors with 3D. Here is a strange Error I have encountered today. Instead of stopping exactly on the other Cube, I get this: When I change the IF to (cube.position.y ...
4
votes
5answers
1k views

Implementing vector based movement in a 2d environment

Good evening. I apologize if the title is a bit vague, I really could not come up with anything better. I am currently reading a book called the nature of code and as a side project, I am working on ...
3
votes
2answers
167 views

What kind of projection is ScreenX=X/Z, ScreenY=Y/Z?

I have an existing class which transforms 3D vectors and projects them on a 2D plane (Camera). The code is all written in C without help from an external library. To project a single vector (X,Y,Z) ...
2
votes
1answer
159 views

front and back face detection

I am trying to implement a dynamic shadow system for a 2d game using this tutorial : ...
0
votes
3answers
157 views

Keeping raycast on the same level

I want my raycast to end at certain height(red line). But as the game is 3D and the camera rotates I can't use a fixed magnitude. What I thought was a stroke of genius, I figured I'd project the ...
4
votes
3answers
978 views

Tetris - Rotations using Linear Algebra (Rotation Matrices)

I'm making Tetris in Java and am at the point of rotations... Originally I was hardcoding each rotation: if (direction.equals("right")) { if (shape.equals("Bar")) { if ...
4
votes
2answers
248 views

Getting an angle in degrees from north

This may have been asked already, but I was unable to find it, because I don't really know what I'm looking for. I drew a picture: I need theta. I've seen various solutions using Vector.Dot, and ...
0
votes
2answers
351 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 ...
2
votes
2answers
549 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 ...
2
votes
1answer
519 views

2D Top down acceleration vector

I have been wanting to solve the issue of movement once and for all... with all that I have learnt and read through, should be a piece of cake one would have thought... , seems it isn't. Having ...
4
votes
1answer
485 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 ...
9
votes
3answers
4k 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
102 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
1k 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
349 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
348 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
74 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
174 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
114 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
366 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
1k views

What's the best way of translating 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 translating that into the closest compass direction? e.g. x:+1, y:+1 => NE x:0, y:+3 => N x:+10, y:-2 => E // closest ...
0
votes
3answers
999 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
801 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
210 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
627 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
152 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
162 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
201 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
374 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
64 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
707 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
197 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
643 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
769 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 ...