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
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 ...
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
102 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
630 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 ...
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) * ...
1
vote
2answers
275 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. ...
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 ...
7
votes
2answers
647 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
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
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 ...
1
vote
3answers
516 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 ...
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 ...
2
votes
3answers
2k 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 ...
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); ...
3
votes
1answer
449 views

Finding closest object to a location within a specific perpendicular distance to direction vector

I have a location and a direction vector indicating facing, I want to find the closest object to that location that is within some tolerance distance (perpendicular distance) to the ray formed by the ...
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 ...
2
votes
1answer
451 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
2answers
960 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 ...
0
votes
1answer
135 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 ...
2
votes
2answers
747 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 ...
2
votes
1answer
208 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
2k 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 ...
0
votes
3answers
412 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 ...
3
votes
1answer
647 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
2k 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(); ...
2
votes
1answer
341 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 ...
0
votes
2answers
580 views

3D Vector “End Point” Calculation for procedural Vector Graphics

Alright, So I need some help with some Vector Math. I've developing some game Engines that have Procedural Fractal Generation for Some Graphics, such as using Lindenmayer Systems for generating Trees ...
2
votes
2answers
202 views

How can I move a polygon edge 1 unit away from the center?

Let's say I have a polygon class that is represented by a list of vector classes as vertices, like so: var Vector = function(x, y) { this.x = x; this.y = y; }, Polygon = function(vectors) { ...
0
votes
1answer
405 views

C++ and SDL Trouble Creating a STL Vector of a Game Object

I am trying to create a Space Invaders clone using C++ and SDL. The problem I am having is in trying to create Waves of Enemies. I am trying to model this by making my Waves a vector of 8 Enemy ...
5
votes
3answers
1k views

Split a 2D scene in layers or have a z coordinate

I am in the process of writing a 2D game engine, and a dilemma emerged. Let me explain the situation... I have a Scene class, to which various objects can be added (Drawable, ParticleEmitter, ...
2
votes
1answer
379 views

Detect if square in grid is within a diamond shape

So I have a game in which basically everything is a square inside a big grid. It's easy to check if a square is inside a box whose center is another square: *** x *o* --> x is not in o's ...
1
vote
0answers
314 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 ...
-2
votes
2answers
517 views

Calc direction vector based on destination vector and distance from enemy in AS3

I'm working on a zombie game in AS3 where I want a character to be able to move away from a zombie depending upon how close the zombie is. The character also has a destination that it's trying to get ...
1
vote
1answer
555 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
500 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 ...
2
votes
2answers
2k views

Smooth vector based jump

I started working on Wolfire's mathematics tutorials. I got the jumping working well using a step by step system, where you press a button and the cube moves to the next point on the jumping curve. ...
0
votes
1answer
477 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 ...
8
votes
2answers
2k views

How do I determine if one polygon completely contains another?

I have 2 polygons. I know the vertex coordinates of both polygons. What's the best way to check if one is completely inside the other? For example, the algorithm should only recognize the black ...
0
votes
2answers
768 views

Rotate point by a direction vector

Given a vector, A, which represents a point, and a unit vector, B, which represents the looking direction, how would I rotate A so that B is the axis that's looked down on? Let's say the looking-axis ...
2
votes
1answer
300 views

Moving Unit Parallel to Mouse in TBS Game

I'm writing a basic Turn-Based Strategy game using Unity3D. It's not grid-based. I've come to the point where I'm coding unit movement, and I'm having trouble figuring out how far to move the units ...
1
vote
4answers
191 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 ...
0
votes
1answer
939 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 ...
-1
votes
1answer
164 views

Find a Rectangle by coordinates - XNA

I have 2 coordinates (X,Y). I have also a 10x10 array. By these coordinates I have to find the rectangle in which is my pointer at the moment. How could I handle it?
3
votes
4answers
3k views

Most effective way to manage a gamestate system that is easy to use?

I just started working on my game, mostly the game management. I plan and using game-states to make the menu's and other stuff easier. My main idea for implementing the game-states is creating a game ...
0
votes
3answers
343 views

How would I successfully split a vector to increase game performance?

Okay so I have a vector for all of the monsters that are spawned in my game. All of these monsters are in a single vector and are "active" according to what zone they are in relative to the player's ...