A mathematical concept that can be used to express position, direction or velocity and which can simplify or outright trivialise spatial problems.
1
vote
1answer
23 views
Vector magnitude in orientation
First, a quick overview of my problem: I have a game entity which has a quaternion to represent its rotation/orientation. It also has a 3D vector in world space for its linear velocity. From the ...
0
votes
1answer
99 views
Vector-based Pong-ball bounce calculations
I'm making a 2D game with pads and balls, sort of like Pong, in Unity 4.6.1. The calculations, however, won't be (very) Unity-specific. The pads are going to appear in various rotations, and therefore ...
0
votes
1answer
59 views
How do I calculate the bounce vector of a ball hitting the starting point of a segment?
I have a ball (with parameters x, y, radius) that travels on the screen (with vectors directionX directionY) and can collide with a segment with random slope (with parameters startX, startY, stopX, ...
4
votes
3answers
109 views
How can I check if a player-drawn line follows a path?
I want to draw an invisible path that the user must follow. I've stored that path as points. When a player draws a line, how can I test if it follows the path I've stored?
Here's an example for ...
0
votes
1answer
74 views
Problems with Raycasting Requirements
Im working on a script which kinda works like an Enemy AI.
Its kinda like a detection system with requirements that are required to be met.
This is a recent question i asked using my code
Raycast ...
0
votes
0answers
40 views
Ray casting: need to find start and end vectors
So I have a 3D object and I'm trying to implement Maximum Intensity Projection on it.
I already started of using a default vector to show per pixel, namely:
pixelCoord[0] = uVec[0] * (i - ...
0
votes
1answer
60 views
Raycast Flashing problem
Can anyone tell me what is wrong with me code ?
If you can see, whenever the player is in range of the raycast. The enemy turns red.
But for some reason. Even when the player has meet the requirement ...
-3
votes
1answer
62 views
Direct raycasting from moving point A and moving Point B
I am attempting to raycast from Point A to Point A (both moving points).
I dont understand the comcept of raycasting (direction).
Update() {
player = GameObject.FindGameObjectWithTag ("Player");
...
1
vote
3answers
80 views
How do I interpret the dot product of non-normalized vectors?
I know that if you take the dot-product of two normalized vectors, you get the cosine of the angle between them.
But if I take the dot-product of two non-normalized vectors (or one normalized, one ...
6
votes
2answers
166 views
How can I draw a line of certain length and direction?
I want to create a line of certain length and direction.
What I mean by this is drawing a line from Point A to Point B.
Normally in Unity C# to draw a line from Point A to Point B is simply:
...
0
votes
1answer
45 views
Rotating a 3d vector around an axis using sines and cosines
I am trying to represent a 3d cone light's direction using only 2 variables. Right now I represent it with two points (6 variables) but I know that the direction in 3d space can be represented by two ...
1
vote
1answer
38 views
How to transform Unity terrain coordinates
My map creator created some terrain in Unity, but all my scripts are based on the X-Y axis. Is there an easy and smart way to transform them into Z-Y, or do I have to change all the vector variables ...
0
votes
1answer
48 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 ...
2
votes
2answers
87 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 ...
12
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
0answers
104 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
149 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
91 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 ...
0
votes
2answers
138 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 ...
3
votes
2answers
211 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 ...
1
vote
1answer
88 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
106 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
93 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, ...
0
votes
1answer
44 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
30 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
393 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
368 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 ...
1
vote
1answer
94 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
209 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 ...
0
votes
2answers
149 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
votes
1answer
66 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
607 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
97 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 ...
-3
votes
1answer
79 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
1answer
89 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 ...
3
votes
3answers
130 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
621 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 ...
7
votes
2answers
312 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
128 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
72 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
votes
3answers
134 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
785 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 ...
0
votes
1answer
84 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
101 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
129 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, ...
1
vote
1answer
446 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
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 ...
3
votes
1answer
1k 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 ...
3
votes
2answers
618 views
How to find point on a circle that's opposite another point?
How do I find the coordinate of point and angle value on circle sprite which placed on opposite side of sprite from a touch point and the center point of the sprite?
I know A position, B position and ...