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
0answers
5 views

Draw my array at a position defined with Vector2

I'm developing a space invaders game in C# using XNA Game Studio. So I got some of the invader logic complete: An array holds the invaders and draws them on the screen, animated and moving.But I can't ...
1
vote
1answer
26 views

Opengl Quad Tessellation Control Shader

I have the generic tessellation evaluation shader for triangles but I need to make it work for quads. Is there any chance someone could explain what is happening here and point me in the right ...
10
votes
1answer
2k views

How do I tell if my enemy can see my player?

Given a player and an enemy with position, and given the direction vector of each, how can I tell if one can "see" the other? In other words, how do I test if one position with direction is in front ...
1
vote
3answers
568 views

How does this circle collision detection math work?

I'm going through the wildbunny blog to learn about collision detection. I'm confused about how the vectors he's talking about come into play. Here's the part that confuses me: p = ||A-B|| – ...
0
votes
1answer
63 views

3D Translations relative to 3D Rotations

I'm trying to program camera movement to be relative to camera rotation. (Forward is always forward, regardless of pitch, yaw, and roll) I want to be able to move forward, backward, left, right, up, ...
2
votes
1answer
72 views

Edit spawn location according to vector direction

I'm trying to make a turret in Bukkit (Java). This will shoot an arrow to the players that are in the shooting radius. But now I've a little problem, the arrow gets stuck inside the block where its ...
1
vote
2answers
392 views

Detecting walls or floors in pygame

I am trying to make bullets bounce of walls, but I can't figure out how to correctly do the collision detection. What I am currently doing is iterating through all the solid blocks and if the bullet ...
3
votes
3answers
3k views

Vector images (SVG or other formats) support in libgdx or other Android framework? [closed]

I'm looking for a website to create games for Android. I'm interested in something that supports vector images. Do you know if libgdx supports them or is there a convenient way to use them in libgdx? ...
1
vote
1answer
467 views

How to move Vector2 along angle?

These are my Vector2's that I am using for this function. public Vector2 position = new Vector2(); public Vector2 velocity = new Vector2(); public Vector2 movement = new Vector2(); public Vector2 ...
2
votes
4answers
2k views

How to find the entity I'm looking at?

I am currently making a mod for Minecraft but I have come to a stop because I am lacking in some knowledge. I need to get data for the entity I am looking at, which I believe requires the use vectors, ...
1
vote
0answers
48 views

Aligning a gameObject to position and normal of another gameObject inside Unity

So I am instantiating a GameObject (the one with cities and trees in the image below) and trying to align it to a hex tiles on a Sphere. So after I instantiate the gameObject, I ray-cast to get it ...
1
vote
2answers
115 views

How can I pass a std::vector<Vector3f> to my shader?

I have a Vector3f type which has x, y, and z properties. I have a std::vector of these vertices which describe my terrain. I would like to pass these values to a vertex shader through a uniform ...
2
votes
2answers
82 views

How to convert non-discreate data for discreate pathfinding?

I have a list of entities that looks like [{x,y,width,height}, {x,y,width,height}, ...]. This list is non-discreate, It doesn't follow a grid. entities can be positioned at floats like x:2.345 Most ...
1
vote
1answer
280 views

Spritekit - gradually apply force vector in different direction (space ship turning)

I have a space ship that I'm applying a force vector to using a joystick for control. I would like this to smoothly fly around when I'm switching directions.. Exactly like minisquadron if you've ...
0
votes
1answer
263 views

Sorting for 2D Drawing

okie, looked through quite a few similar questions but still feel the need to ask mine specifically (I know, crazy). Anyhoo: I am drawing a game in 2D (isometric) My objects have their own arrays. ...
3
votes
2answers
170 views

How do I make a 2D race car turn smoothly? [duplicate]

I'm making a competitive 2-player 2D racing game for a school project. I'm struggling with the movements of my car: I made it a square for testing purposes and it can move left, right, up or down, but ...
0
votes
2answers
71 views

c# Unity - Matrix output incorrect on vector rotation

I have a input Vector (1,1,0) when I run it through a Unity Matrix4x4 class with a rotation of 90 degrees around the Z axis the output is (-0.9999999,1,0) which is nearly correct but strange. But ...
-1
votes
1answer
237 views

Make Gameobject Stand On Surface Facing Certain Direction

I want to make a biped character stand on any surface I click on. Surfaces have up vectors of any of positive or negative X,Y,Z. So imagine a cube with each face being a gameobject whose up vector ...
-1
votes
3answers
1k views

Move player to mouse click

Im hopelessly not good at algebra and such. But im trying to learn. I want to learn and understand how to use it in game programming rather than modifying snippets or using classes that do it for me. ...
1
vote
1answer
82 views

Rotate an arrow on a plane?

I'm creating a display for a GPS-based embedded system and would like to have an arrow indicating the current bearing. I'd love the arrow to have a 3d appearance by rotating it on a plane tilted up ...
0
votes
0answers
104 views

3d game math problem [duplicate]

i'm very much new to 3d math operations. I know how to rotate 3d points certain degrees arbitrarily by any axis but we were given a strange problem to think on. I'll spare using actual numbers on ...
0
votes
1answer
37 views

using rperp or perp to find perpendicular of a vector

i have code local coordinate Vec2 velo = Vec2(100,0); Vec2 Heading = velo.getNormalized(); Vec2 side = Heading.perp(); Vec2 trans = Vec2(12,12); then i can generate toWorldCoordinate for trans ...
0
votes
1answer
28 views

Determining if a Point3D passed another

I have 2 points A and B in 3D space (say of type Point3D). B needs to travel towards A and then stop either when it reached or passed B. The direction between the two points is known (can be easily ...
3
votes
2answers
227 views

How to calculate left/right oriented angle between two 2D vectors? [duplicate]

I would like to calculate angle between two 2D vectors. Here's a picture of what I'm trying to achieve: I have an obstacle line segment AB and incoming moving PC. If I'm coming from one side C¹D¹ ...
1
vote
1answer
71 views

Smooth anmiation with LibGDX

I want to move a enemy from its current position toward the mouse position in LibGDX. x, y - enemy position saveX, saveY - position where my enemy need to go(or mouse position saved at specific ...
1
vote
1answer
349 views

Beginner: How do I calculate a vector?

I am trying to wrap my head around some concepts in a side project I'm working on. I'm struggling with how I can calculate a vector based on my character movement logic. Here are the relevant details ...
0
votes
2answers
130 views

Explaining vector math for a pendulum camera

I came across a code that I guess is doing a pendulum camera, that's the class name. I would like to know the math behind that. I would like also to know how to decipher those stuff in game math, ...
1
vote
1answer
92 views

Opentk LookAt() and 'eye' argument rotating

I'm trying to create rotating camera, which looks down by 45 deegre like this: However my code for rotating eye vector is not working properly and I achieve vertical rotation, when it should be ...
0
votes
0answers
21 views

get vector of enemies that facing player [duplicate]

if I have player location (4,6,-3), thee y- axis is vertical and I have enemies at (7, 6, 12), (16,6,11) and (11,6,1) how to calculate the vector of each enemies that is needed to face the player? how ...
-1
votes
1answer
60 views

MVP Matrix * Vector3 = Black Screen? [closed]

I'm relatively new to computer graphics so please take it easy. I created a ModelViewProjection Matrix and I sent it to my shader: #version 330 core layout(location = 0)in vec3 vert; uniform mat4 ...
5
votes
1answer
539 views

What's the 'proper' way to get unit vectors?

My apologies if I've misunderstood the term 'unit vector' or misapplied it in concept, but I think that is the term for an object's heading when expressed as [x, y] when x and y are a value between -1 ...
2
votes
1answer
47 views

Libgdx : point that scrolls on the edge of a circle

I'm not very familiar with libgdx vectors. I want to create my own joystick-controller and I want to know how can I find the coordinates of B by using Vectors. I can calculate the radius and I have ...
4
votes
2answers
403 views

What are the properties of “position, velocity, acceleration, rotation” collectively named?

They say naming things is one of the hardest problems in computer programming. They were right. Given the pseudocode below, what is a more appropriate name for this collection of properties? ...
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 // ...
-3
votes
1answer
73 views

What's wrong with my step-toward-target implementation? [duplicate]

I want to move a game object from its current position toward the mouse position. I wrote this Vector2D class to help me: public class Vector2D { private double xVect; private ...
3
votes
3answers
124 views

2 component unit vector

Is it possible to store a 3d unit length vector with only 2 components, for example as coordinates on a unit sphere? It seems possible but I have never seen anyone do this. Would this be at all ...
4
votes
3answers
600 views

What is a direction vector and why should it be normalized?

I've been trying to get the hang of vectors and I read Wolfire's blog about linear algebra and I seem to understand most stuff except when it comes to storing a direction as a vector and using it by ...
2
votes
2answers
447 views

Intelligently move aircraft using curves

I am trying to code a script to move an aircraft entity from point A to point B and at some point in the middle of moving have the aircraft forward vector face Point C (to fire a missile at an enemy ...
7
votes
2answers
233 views

How do I find the closest points(thereby forming a polygon) enclosing a particular point?(see image)

I am working with a game engine, and my task is to add code for simulating fracture of rigid meshes. Right now I'm only working on breaking a cube. I am using Voronoi's algorithm to make a ...
0
votes
1answer
112 views

How do I find the angle between two 3D angles represented in this form?

I have two 3D angles, represented by [a1,a2] [a1,a2] where the a2 is < 180. My coordinates are represented as [X,Y,Z], where X,Y,Z are 64 bit ints (longs in my lang). My direction angles are ...
0
votes
2answers
47 views

Converting A 3D Rotational Vector Into A 3D Forward Heading Vector

I need to do a raycast which accepts a Vector3D StartPos and a Vector3D EndPos. I have available to me the characters position and the cameras rotation in 3D vectors. I need to somehow compute a ...
1
vote
3answers
839 views

What Java class should I use to represent a Vector?

Does Java have a built-in Vector class suitable for handling collision detection / response? It should have methods like subtract(Vector v), normalize(), dotProduct(Vector v), ... It seems logical to ...
-1
votes
3answers
102 views

Shooting based off mouse position [duplicate]

I'm trying to shoot bullets where the mouse is aiming using one image as a test. I'm trying to get the mechanics like this I have some kind of algorithm to handle that but the results arn't too ...
0
votes
1answer
367 views

Simultaneously translating and rotating sprite in Unity

I have a 2D object (a PNG file I dragged onto the screen) which is a circle I would like to move left and right when the correct side of the screen is touched and have it rotate in the respective ...
2
votes
1answer
685 views

Orthographic Camera and Raycasting in Three.js

I'm working on a test project porting a simple game from iOS to Javascript. I've got the orthographic camera working and it can view the objects in the scene and move up and down the tower of meshes ...
0
votes
2answers
97 views

Collision detection: Swinging bat/racket and ball

I am programming a side-view tennis game, inspired by an old arcade game, using Javscript and HTML5 canvas elements. The player can move left and right and holds a racket at arms length which can be ...
0
votes
1answer
69 views

Loading non-square textures, from a 256x256 spritesheet in lwjgl(JAVA)

so I'm doing lwjgl, so far I have the loading of 16x16 textures from a 256x256 spritesheet all working, using this code to get the location of the textures: public Vector2f[] calculateUVMapping(int ...
0
votes
1answer
88 views

Rotating a vector around a vector in 3D space

I am trying to rotate a moon around a planet (the planet is also rotating around an axis) but I am having trouble doing so. I tried to make the model move through space like so: @Override public ...
1
vote
0answers
107 views

unity3d-Find angle between 3 vector3 points obtained from swipe

I was trying to find the angle between 3 vector3 points obtained from the screen swipe. The first vector3 point is the first touch position fp, the second is some intermediate touch ip and the third, ...
0
votes
0answers
44 views

How to make a game like “pewpew”? [duplicate]

I have a question about the graphics of these games like "pewpew", "geometry wars". Pewpew. Visit here: https://play.google.com/store/apps/details?id=com.jyaif.pewpew&hl=en How these games are ...