Tagged Questions
3
votes
2answers
110 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) ...
0
votes
3answers
83 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
2answers
144 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
0answers
51 views
Uses for vector projection?
My previous question was solved by vector projection. Thus I spent some time studying it (Few helpful links: Interactive projection, short video and a longer video.).
There were plenty of sites that ...
3
votes
3answers
188 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 ...
0
votes
1answer
65 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 ...
1
vote
1answer
92 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
161 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 ...
1
vote
1answer
271 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
304 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
178 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 ...
1
vote
2answers
566 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
88 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
518 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 = ...
1
vote
2answers
116 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
144 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
185 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
281 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 ...
3
votes
3answers
134 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 ...
1
vote
2answers
147 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
190 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 ...
0
votes
2answers
474 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
2answers
248 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 ...
3
votes
1answer
291 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 ...
2
votes
1answer
213 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 ...
1
vote
1answer
602 views
Interpolation between two 3D points?
I'm working with some splines which define a path a character follows (you can see a gameplay video here to get a better understanding of what's going on: http://www.youtube.com/watch?v=BndobjOiZ6g). ...
0
votes
1answer
1k views
The normal vector to a plane ax+by+cz+d=0?
I am calculating the normal vector to a plane ax+by+cz+d=0
According to the book:
The normal vector N is often normalized to unit length because in that case
the equation
d = N â‹…Q + D
gives the ...
0
votes
2answers
160 views
How do I make a vector exactly reach a line?
Let's say a vector starts at Point P and points in the direction of v. How do I make sure that this vector exactly reaches the line? Its end should be exactly on the line, and not cross it.
1
vote
4answers
179 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 ...
-1
votes
2answers
171 views
How to make sure that a Point A moving in the direction V reaches at Point B?
Let say I have,
Point A(X1,Y1) moving in the direction V(W, H). I need to make sure that it reaches B(X2,Y2). I think I need to subtract some value in Point A(X1, X2). But not know what? I also sure ...
2
votes
1answer
127 views
Calculate the direction, From Outer Polygon Point to Inner Polygon inside Point
I was able to find the co-ordinates of inner Polygon using this trick.
Need the co-ordinates of innerPolygon
But, I have some problem in getting the direction from Outer Polygon Point to Inner ...
3
votes
2answers
84 views
Need the co-ordinates of innerPolygon
Let say I have this diagram,
Given that i have all the co-ordinates of outer polygon and the distance between inner and outer polygon is d is also given. How to calculate the inner polygon ...
2
votes
1answer
314 views
Confused about order of operation when using a Matrix in XNA, C#
Here are two different pieces of code
This is what I started with
Vector2 hold = Vector2.Transform(pos1, mat1);
Matrix inv = Matrix.Invert(mat2);
Vector2 pos2 = Vector2.Transform(hold, inv);
And ...
4
votes
1answer
469 views
What is a good way to determine if a vector is between two other vectors?
I could operate with the angles, but I do not have the angles calculated yet (and would like to avoid having to do that). It would be possible to calculate and cache the local-coordinate-frame angles, ...
2
votes
4answers
1k views
How to detect if object is moving in clockwise- or counterclockwise direction?
I've read this one, but I need more info: rotating an object from sourceAngle to destAngle, both 0-359, clockwise or counter clockwise?
I have a ball. The user is able to drag the ball in any ...
0
votes
1answer
182 views
How can I draw a line rotated some number of degrees away from an original line?
I have a line ahead of my moving object to serve as a raycast and its aligned with the object's movement direction. But I want also some extra lines according to an angle related to the 'head' of the ...
3
votes
4answers
448 views
How to draw a line of a given length towards a given object?
I wanna draw a line between two moving objects
I can't use:
cDrawLine(startPointCG, endPointCG);
because the line must have a length. So I'm trying to measure the angle between those two points ...
6
votes
2answers
819 views
Vector games (Wireframe, Elite-like) theory and implementations?
I'm interesting in knowing more about how vector games like Elite and Star Wars Atari were built from grounds up. The question is not how to implement vector graphics with modern 3D APIs like OpenGL ...
2
votes
1answer
264 views
What is wrong with my technique for transmitting server and client game state?
I'm doing a network implementation of a fast-paced game. I have a puck on bot the server and client side of the simulation. I want to update the client puck position only if they are on the same ...
8
votes
2answers
2k views
How do I linearly interpolate between two vectors?
I have a velocity vector where my client is at and where its going, and I have the same vector that comes from the server telling where the client should be. Sometimes its a bit different, so I want ...
7
votes
1answer
268 views
How do I find a point on a line?
I have two points (A, B) and the length of d. How can I find point C?
12
votes
1answer
2k views
Determine arc-length of a Catmull-Rom spline
I have a path that is defined by a concatenation of Catmull-Rom splines. I use the static method Vector2.CatmullRom in XNA that allows for interpolation between points with a value going from 0 to 1.
...
4
votes
2answers
1k views
How to calculate the vector of an interception?
Given are a twodimensional space, and 1 friendly spaceship standing still, one foe is moving NOT directly to the friendly ship with known actual position, speed and direction.
The friendly ship wants ...
12
votes
5answers
2k views
Do I need the 'w' component in my Vector class?
Assume you're writing matrix code that handles rotation, translation etc for 3d space.
Now the transformation matrices have to be 4x4 to fit the translation component in.
However, you don't actually ...
5
votes
1answer
944 views
Rotate object to face player
This is probably a simple vector question, but I'm not sure how to do it.
I have an object at vector position (ox,oy). Potentially every update, the user walks around the screen, and will be at ...
7
votes
3answers
1k views
Rotating a vector by another vector in shader
I have a terrain surface with a normal for each point on the terrain.
I have a second detail normal map to be applied to the terrain.
These normals are in 3-space.
The Y value of both normals is
...
9
votes
4answers
349 views
What exactly causes a surface to overlap another?
I cannot really figure out what causes one surface to overlap another. In a 3D engine I'm creating, my technique is failing in edge cases.
My method is sorting the surfaces to be painted from the ...
2
votes
1answer
362 views
Calculating camera zoom value (top-down)
I need some help in 'camera maths'. I have a birds eye view of two characters. One character is static and the other can move. I would like the camera to always show both characters in full and, in ...
1
vote
3answers
464 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 ...
2
votes
1answer
427 views
Calculate the initial velocity of a 3D trajectory
I've got a 2D projectile code sample working, but would like to extend it to 3D. How would I calculate the initial velocity of the Z-axis? At the moment, I've got:
initVel.X = (float)Math.Cos(45.0);
...
