Questions tagged [linear-algebra]

Linear algebra is the branch of mathematics concerning vector spaces and linear mappings between such spaces. The tag is generally used for questions regarding calculations over vectors.

Filter by
Sorted by
Tagged with
0
votes
1answer
66 views

Calculating child world translation, rotation and scale

I'd like to know if it's possible to calculate a child's world translation, rotation and scale individually. I'm used to seeing devs resorting to matrix multiplication and then decomposition, like so: ...
0
votes
1answer
103 views

Rotation of a 3D ball on a plane

This used to be on the physics stack exchange but I was told to put it here: I'm making a game (with physics) and I have a 3D ball rolling down a flat plane. It moves perfectly fine, but the rotation ...
1
vote
1answer
34 views

Find point along x axis where yz plane flips to back facing after perspective projection. Have a solution but don't know why it works

I am trying to find the point along the x axis where a plane with normal pointing along the x axis would flip to back facing after perspective projection. Essentially the red line in this image. My ...
5
votes
1answer
4k views

What does a linear transformation preserve?

They say an affine transformation preserves points, lines, parallel lines etc. I can see this if I think in terms of translation [Is there any other affine transformation you can give as an example, ...
0
votes
1answer
997 views

Shortest distance to chain of line segments

I'm trying to calculate the distance of the player to a few lines that intersect two points, and return the smallest distance (i.e. tell me which of the lines the player is closest to/how far the ...
0
votes
1answer
200 views

Understanding use of dot product in speed boost pad

I am trying to understand the dot product. I have found a website that gives you intuition about this topic and one of the examples involves a speed boost pad: Imagine the red vector is your speed (x ...
0
votes
1answer
225 views

Project 3D points to a plane, then project their bounding box back to 3D

I have a table in 3D space, represented by a plane. I want to project arbitary points representing an object (cup, toy, etc) onto that table, run 2D principal components analysis to get an oriented ...
0
votes
1answer
88 views

Difference between World matrix and Model matrix?

My current understanding of the Model matrix is that it is per object and stores the transformation, rotation, and scale of the object in local object space. What I'm not sure about, is that whether ...
14
votes
2answers
3k views

What are some good examples of the practical usages of cross product in game development?

I know how to calculate cross product, and know that the cross product of 2 vectors is a third vector that is perpendicular to a plane created by the first 2 vectors. However, I have not seen any good ...
0
votes
1answer
73 views

Writing a sphere-sphere intersection function

I am writing a function where I have two 3d points with coordinates {x, y, z} both with a line segment of a given length. I am trying to find a common endpoint between the two line segments closest to ...
0
votes
0answers
40 views

How do I create surfing?

I want to know how I can lerp from my current position, to another position, while hugging the terrain. Imagine I'm doing something like surfing, or skateboarding, where I need to follow the rail......
0
votes
0answers
25 views

Do vectors have to be normalized for dot product to be useful? [duplicate]

Why do I get two entirely different answers when I do and do not normalize my vectors. When I don't normalize them, they give me some very large numbers which aren't useful.
1
vote
0answers
43 views

Struggling with 3D math concepts. Would like practice [closed]

Hello fellow game developers! I graduate this October with my Bachelor’s of Game Programming and Development. I took the required Calculus and Linear Algebra. While I passed the classes I feel like I ...
0
votes
2answers
187 views

XNA Rotate Vector2 around Origin

I have a Rectangle and a Vector2 position, my sprite is being drawn at this position. The rectangle is meant to be a collision system with the cursor, when I rotate my sprite around the origin and ...
1
vote
1answer
802 views

THREE.JS - How to know the shortest rotation direction an object must do to look at other?

I am trying to understand a way in THREE.JS (and the mathematical foundation) to get the direction an object should rotate to lookAt other but without actually rotate it. I've tried to use ...
0
votes
1answer
64 views

How to get correct axis for scaling from transformed space?

I have scaled and non-scaled representation of model so that I don't destroy verticis information if model will be scaled to plane, for example. Now I trying implement scaling on model elements (face, ...
0
votes
1answer
23 views

How to check if a line casted from one point to another point passes through a mesh?

Let's say we have two vectors A and B. Is there a way to use Three.js' Ray or Raycaster classes to cast a line between vector A and vector B and check is it passes through a mesh in the scene? I know ...
0
votes
1answer
113 views

Invert parent transform (doesn't work for combination of rotation and scale)

My problem I'm working with Qt3D and my problem is almost exactly like this one: https://stackoverflow.com/q/60995155/3405291 Suggested solution A solution is suggested here: https://stackoverflow.com/...
1
vote
1answer
50 views

Linear algebra: Are vectors that define a game object considered to be a subspace?

In Linear-algebra a subspace is a collection of vectors that when added with each other or scaling would result in another vector in that same subspace. How does subspaces relate to objects/players ...
0
votes
0answers
13 views

Line Clipping and warped Picture

So hello to all of you, I wrote some pseudo 3d Code in QB64 (just for testing) and I managed to get the program running. So my problem is, that i get some disorted pictures when it renders the walls. ...
0
votes
0answers
27 views

How to check if a particular vector is pointing at X-Y plane or Y-Z plane

As you can observe from the diagram, Vector A is pointing at the Y-Z plane and Vector B is pointing at X-Y plane. Is this possible to find? Am I missing some logic or concept? EDIT: Suppose, Vector B ...
0
votes
1answer
89 views

Transforming Vector3 points to Vector2

I'm trying to convert a list of Vector3 on Vector2 because I need to put them in a graph like this: The graph is easy to do having the Vector2 list, but I have a non-trivial problem obtaining the ...
1
vote
2answers
47 views

Given its direction, and another vector that begins at the same point, how can I find the magnitude of that vector using only vector math?

I've solved this using the law of sines, but I was wondering if there's a way to do this with just vector math. Here's a diagram that will hopefully help illustrate what I'm trying to do: Given ...
0
votes
0answers
31 views

Rotating a cube with arrow keys

I have a list of rotations (on a cube in 3d space with the y-Axis pointing upwards, x-Axis pointing righthand and z-Axis pointing towards you) for example +90 deg around x-Axis followed by +90 deg ...
0
votes
0answers
19 views

Scaling transforms by time, Eigen Decomposition of Affine Transforms

I posted this question in mathematics, but that sight gets flooded with homework problems... 8 views total, most of them me. Plus, I think this question is more geared to game development anyway. I am ...
1
vote
1answer
71 views

Find projecting triangle for UV mapping in RuneScape model format

I am using an old Runescape model format, also used by Thief and Quake. In this format, instead of specifying UV coordinates for each vertex ABC, we specify a second trio of vertices PMN. Those ...
1
vote
1answer
118 views

How to mirror a vector through some other vector?

I have a player's direction (playerDirection). I want to fire two bullets, one rotated by -30f, and one by 30f, so it looks like this: Blue line is the ...
0
votes
1answer
64 views

How to detect direction of rotation?

I have a character with a camera behind him. The head of the character rotates with the LookAt function on the character's head rig. The ...
0
votes
0answers
23 views

Is there a way to invert the scaling of the axis and keep the orthogonality?

Recently I ask question and since then been decide to find solution by dividing scale matrix to two part GlobalScale and ...
-1
votes
1answer
299 views

Can not seem to adjust the speed of my Car

I'm programming in C++, rendering in OpenGL and using GLM for matrix/vector manipulation and ...
16
votes
4answers
30k views

How to detect 2D line on line collision?

I'm a flash actionscript game developer who is a bit backward with mathematics, though I find physics both interesting and cool. For reference this is a similar game to the one I'm making: Untangled ...
1
vote
1answer
171 views

How to Make GameObject move in Circular Motion

I've been trying to work an enemy that moves in a circular motion for my RPG game, but for some reason, whenever I press play the GameObject instantly goes hundreds of units in the X and Y coordinates....
0
votes
1answer
326 views

Arc length between two angles

As I calculate the length of the arc (green) between two angles; I need a method like: arc_lenght (xpos, ypos, radius, ang1, ang2) { return arc_lenght }
0
votes
1answer
42 views

How to re-calculate orientation vectors when one of them is being changed?

I want to implement a Unity-like API for my transforms, with the ability to set forward, right, up vectors directly and change object's rotation quaternion accordingly. I got stuck at the math behind ...
2
votes
2answers
268 views

LibGDX Efficient way to reduce a vector's value gradually until it reaches 0,0

I can manage to achieve this but the code seems to be much longer than it should be. Velocity is given an initial value, either positive or negative and then is ...
4
votes
1answer
255 views

How to scale major and minor radius of a quarter torus

I am dealing with quarter tori as in the image below. My issue is that I need to be able to scale its major radius and minor radius separately using a scale matrix. However, when I use a regular ...
0
votes
1answer
775 views

Should 3D transformations be represented by a 4x4 matrix or a 3x4 matrix?

Since 3D transformations are represented by 4x4 homogeneous matrices we know that their last row is always (0,0,0,1), and as such the behavior of this final row is implied so long as we know whether ...
0
votes
1answer
255 views

Ordering vertices of a face for correct triangle definition

I'm trying to ascertain the appropriate order of vertices for the face of a mesh that is programmatically created. Currently the face is always a quadrangle, but eventually a face can consist of any ...
0
votes
1answer
119 views

What is the signifigance of the Dot Product in World to Local Transformations?

Looking for help understanding why this World to Local Space function works. I'm working my way through Buckland's Programming Game AI By Example The following function is used in the book to convert ...
0
votes
1answer
66 views

Check if point is inside convex hull

I first tried with a simple axis aligned bounding box to test my algorithm (later shape will be different but always convex 6 faces), but even this case did not work, it always tells me that the point ...
3
votes
4answers
9k views

Line triangle intersection - last bits

I'm doing line-triangle intersection. I have found the intersection point (vector) on the plane. All I need to do now is work out whether the point is inside the triangle it collided with (not the ...
2
votes
1answer
1k views

Why does a unit vector show direction?

If I have two objects, Person A and Person B, and I want to know if Person B is facing the same direction as Person A; once I have the vectors, how do I use the normalized vector to show direction? ...
5
votes
4answers
14k views

Equation to make small number big and big number small (gravity)

I have a sprite that I want to speed up as it gets closer to another object. I really want this to flow well and don't want a series of if statements. All I can think of is to take the distance and ...
0
votes
0answers
104 views

OBB Frustrum Culling in Clip Space

I've been trying for a while to implement a frustum culling method using a per-computed AABB in object space and transforming it's corners into clip space. ...
1
vote
1answer
69 views

2D Collision detection: rewinding to moment of first intersection

I am working on a collision system in a Platformer tile-based game. All tiles are AABB. I am trying to implement "Rewind to Moment of First Intersection" mentioned in this post's second point. The ...
0
votes
1answer
349 views

How to create a custom set of coordinates based on two points in Unity?

As the title says, I am having problems finding a way to create a new set of local coordinates based on two points. Here is an example: Consider that the two gameObjects are not one parent of another,...
0
votes
2answers
344 views

How do I detect collisions between a point and a sloped line?

The character in my game constantly falls due to gravity, so i have to detect the collision between the bottom point of the character and the tile slope line on the same x coordinate. The character ...
0
votes
0answers
60 views

What is a good algorithm for generating a linear regression of positions in 3D space? (for getting the direction of a thrown object in VR)

I'm trying to get throwing to feel right in my VR game. I don't plan on actually using physics to do this; my idea is to accurately determine the lateral direction of the throw, then move the object ...
1
vote
0answers
54 views

How to vary the initial velocity of a jump based on hold time?

What I want to do is, the longer player holds the screen, the longer distance the object will jump when they release the hold. Here is my code: ...
4
votes
1answer
2k views

How does a 4x4 matrix represent an object in space and matrix lore?

I have been following some tutorials on how Matrix maths works, with adding, dividing, scaling, etc, but I am struggling to understand how the 4x4 matrix represents an object's position in space. ...