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.
264 questions
1
vote
1
answer
168
views
Understanding the math behind procedural aiming animation
I'm creating a procedural aiming animation system in UE5 as a learning experiment.
In order to position the hand for aiming down sights, I'm using a forward vector from player camera to project out a ...
0
votes
1
answer
102
views
How to virtualize an 8-ball pool table for an AR game which uses both real and virtual objects using Meta Quest 3 (v77) and Unity 6
I am creating an AR game in where I would like to virtualize an 8-ball pool table. Since semantic labeling is practically useless, I would like to have some manual placement of objects and some ...
0
votes
1
answer
161
views
Is the "View transform" just a change of basis matrix + a translation applied to each point? (to bring them into camera space)
I am learning about the graphics pipeline. My understanding of the view transformation is that you:
First create a normalized, separate coordinate system for the camera, based on its position and ...
1
vote
1
answer
578
views
Given two points (A and B), how can I obtain a point a set distance along the line between them?
Let's say I have position A, that is (0,0) and Position B that is (10,5).
Now let's say I know that position C is 5 units' distance from position A in direction to Position B.
Provided that the ...
1
vote
1
answer
72
views
Pan orthographic non-axis-aligned camera
I'm trying to create a panning control for a camera in bevy, but I can't seem to get the panning logic right when the camera is rotated. It works fine if the camera transform is directly facing the XY ...
1
vote
1
answer
93
views
Orbit Camera In vulkan
I've been having trouble trying to make a solidworks style Orbit Camera, nothing I do seems to work even though apparently it should (I've tried multiple methods and this seems to be the most ...
0
votes
1
answer
195
views
How to tell when calculating an Intercept Point between two moving objects, when it will never intercept?
I'm not a maths person and the formulas you see on maths type questions/answer with all the symbols is completely beyond me - I'm sorry. However I had help about 18 months ago to turn a provided ...
2
votes
0
answers
122
views
Calculate Up Vector of Object on Surface Given Points and Normals
Context
I want to find the up vector an object would have if it were leaning on a surface, given a large amount of points on that surface and their associated surface normals (i.e., an equation that ...
1
vote
0
answers
78
views
3D transform hierarchy rotation applied in wrong order
I'm following in the footsteps of this blog in implementing a transform hierarchy to my game engine scenes. I have a fairly similar implementation for a 3D transform:
...
1
vote
2
answers
279
views
Calculate path segments size
I have a problem more closely described on a picture below.
The idea is that I have my agent in point A and I want to get to the point B. The problem is, that agents rotation towards point B is alpha ...
0
votes
0
answers
47
views
Ray-Sphere Intersection Always States Ray Origin Is Point Nearest Sphere Center
I am writing a simple graphics engine using Rusts WGPU. I have a Sphere rendering at the origin of my scene like so:
...
0
votes
1
answer
66
views
What is the relation between the magnitude of the cross product and dot product of two vectors?
If I have an equation:
|A×B|=A.B
What would be the angle in between A and B?
0
votes
1
answer
114
views
Getting the scalar speed from an X and Y velocity [duplicate]
Given a Vector2(x,y) that represents an object's velocity, like so:
...
0
votes
1
answer
211
views
Inconsistent Speed Of A Projectile Traveling On A Bezier Curve
What I'm doing:
I'm moving a projectile to it's target along a Bézier curve with one control point.
The projectile moves from Transform A to ...
0
votes
2
answers
446
views
How do I use these Unity math functions in Godot C#?
Here's a list of math functions I'm having trouble finding a direct function match for in Godot C#:
...
10
votes
3
answers
9k
views
How do game engines avoid recalculating normals upon mesh rotation?
Assume that a face of a mesh is defined by vertices A, B, C and that the normal of the face ...
0
votes
0
answers
321
views
Generating tris for concave polygon 2D
I have an arbitrary array of points that describe vertices of the polygon 2D, they ar in order. To generate plane mesh for that, I need to generate tris. For something like circle/hexagon/square it is ...
2
votes
2
answers
330
views
Finding the closest point on a circle to end of a ray in 3D
I have a circle in 3D space, so we have center C with radius r, and the normal of plane the circle lies on, N. There is also a normalized vector V that I am modifying to go far past the circle's ...
0
votes
2
answers
194
views
How to calculate shadow position below arcing projectile in Isometric 2d tilebased grid?
I have an Isometric 2D grid-based tilemap, and am firing a projectile (at Vector P1 in image below) from the player (at Vector A) to a location "above" a target location (at Vector B). This ...
0
votes
0
answers
75
views
Calculate direction to push player away from wall
I'm trying to write a common 2D game and using vectors for physics.
I have 1 wall and 1 player object that can move diagonally (both are squares without rotation).
When the player object collides with ...
0
votes
2
answers
324
views
Convert terrain vertex position to global position
I am trying to set the terrain's heights data at runtime with a simplex noise function, while stumbling with converting the local position of the vertices to global position to use as input to keep ...
1
vote
0
answers
253
views
Deflecting projectiles back towards enemies
I am working on a 2D side scroller. I have created an enemy character that shoots at my player randomly within a specific time interval. So, I want to deflect the projectiles back toward the enemy ...
0
votes
1
answer
1k
views
How to set up view and model matrices for 3D rendering?
For various reasons I am building a very simple graphics engine. I have a pretty good 2D thing using plain SDL2 and C that essentially boils down to a single "putpixel" function. I can ...
0
votes
1
answer
62
views
Error in directional light shadow projection matrix
I have VC++ code for DX9 that draws shadows perfectly.
...
0
votes
1
answer
181
views
How to find the distance to the middle of the road from the car's current position?
I have the car's current position Vector3 and an API that gets me the closest point on the middle of the road to any Vector3 ...
1
vote
1
answer
235
views
What's the purpose of this cross product and dot product in triangle clipping code?
I have this code that inserts a triangle into the drawing list. The PHD_VBUF structure stores one x,y,z vertex. If the vertex is behind the front plane, then ...
0
votes
0
answers
70
views
Predict whether projectile is coming at a teammate
Related to this question How to project a Vector3 onto the xz plane?
...
1
vote
1
answer
1k
views
How to project a Vector3 onto the xz plane?
I have this code that tries to check whether a lobbed grenade will head toward a teammate:
...
0
votes
1
answer
130
views
Align two meshes given 2 faces
I have two meshes (A and B) and I know that a triangle in A has the same size and same angles as a triangle in B.
For simplicity, suppose A is an octahedron and B is a tetrahedron. And suppose the ...
0
votes
1
answer
193
views
Find where two (mirrored) 2d vectors intersect a rectangle bounds
I've created a 2d gradient shader which uses an absolute start/end point to determine how an arbitrary amount of colors are positioned along the gradient line. I now am creating an api to create a ...
0
votes
1
answer
99
views
How to encode homogeneous transformations on the root node of a gltf
Let us say we have a gltf asset. Let us say we want to apply an arbitrary linear transformation to the root node.
We will say that the root node has a rotation, translation and scaling components. For ...
0
votes
2
answers
1k
views
Aim projectile to intercept moving target from a moving ship
So I have created spaceship shooter game where ships have turrets on them . Now I want those turrets to shoot a moving target meaning I want the projectile to intercept and hit the target that is ...
0
votes
1
answer
3k
views
Using atan2 vs dot product to get an angle in 2D games
I have some confusion that I need to be cleared up about the atan2 function.
I am making a game in Godot where a 2D ship rotates to face some object in space by ...
0
votes
1
answer
262
views
2D turret aiming at the player, but only within a certain arc and with a defined angular velocity
I have a turret game object and a player game object, say it's a spaceship.
Right now, every frame the turret updates its rotation, so it's always pointing at the player, giving it potentially ...
0
votes
2
answers
373
views
Cue ball direction after collision
I am trying to figure out the velocity of ball A after collision, which is V2.A as seen in the figure. I know that the velocity of ball A is perpendicular to the line connecting centre of ball A and B ...
1
vote
1
answer
2k
views
How to divide a Vector3 to recover a scale factor?
I have object I'm scaling by setting its localScale to (1, 1, 1) multiplied by a float size.
...
1
vote
1
answer
248
views
Given a quad in 3D space with two diagonally opposite points and normal, how would I find the other two points?
Image attached below for clarification:
So here we have a plane with a random rotation in 3D space, and we have the values for P1, P2, and the plane normal. How do I find the points X1 and X2?
This ...
-1
votes
1
answer
143
views
Move object on World's XYZ axes
I'm trying to move my Character on the world's XYZ Axes, but how do I get them?
I'm trying to do this because my Player is sort of a Sphere and is rolling around, so its xyz directions are rotating.
I ...
0
votes
0
answers
80
views
Compute thrust applied to ship's sails depending on sailSize, sailState and relative angle of wind
I'm trying to calculate the speed of a ship, depending on many factors.
the speed of the wind
the relative angle between the sails forward and the wind forward. transformed into ...
0
votes
1
answer
263
views
Get component of velocity parallel to a normal
I would like to transform a rigidbody's world velocity into a local velocity based on a normal direction.
When the rigidbody is moving towards and within a range of a object, I use a raycast to ...
0
votes
1
answer
136
views
2D Vector local to global space without trig/sqrt
Per this answer to this question, a cheap way (i.e., without trig/sqrt) to convert from global to local space, given LocalOrigin, LocalI, LocalJ, and GloablPoint is (in rough pseudo code)
...
1
vote
1
answer
110
views
How to insert a new control point on 3D cubic Bézier spline, without deforming current shape?
I have a spline generation system using a cubic Bézier algorithm.
I created a tool that splits the spline and adds a new point where the user clicked on the spline,
but it causes the spline to deform ...
0
votes
1
answer
1k
views
Is it possible to calculate a direction vector without sqrt?
I'm not using Unity or any other library for making game logic. I'm making a basic game logic that needs to do basic vector math on the backend side.
I just wrote a direction function that needs to do ...
2
votes
1
answer
2k
views
Calculate normal and plane orientation using 4 3D points
I have 4 points as Vector3 in 3D space that shape a plane. How can I calculate the plane normal direction these four points create together, and express it as a <...
0
votes
1
answer
135
views
I cannot understand this change of basis problem
I know we need to get the inverse of transformation matrix first to get the coordinate relative to other frames. Explanation is in this video.
I am reading directx11 book. And the following ones are ...
0
votes
0
answers
192
views
How does this 4 by 4 matrix (about 4 points are coplanar) come up with this equation?
I have just begun learning some 3d mathematics and OpenGL (trying to implement skeleton animation).
I am stuck here when reading a book(Advanced Methods in Computer Graphics). I understand the first ...
2
votes
2
answers
540
views
How to find vector representing altitude of a triangle?
I'm trying to find this green vector and I've got three points A, B, C. How can I find that vector in Unity code-wise?
3
votes
1
answer
397
views
How to navigate a moving 2d spaceship under newtonian mechanics to a point in space?
I am creating a real-time game where ships move through space using basic laws of motion. The ships move by rotating (instantly for our purposes) to an angle and then firing their engine to accelerate....
0
votes
2
answers
260
views
X axis intersection with inverted Y axis coordinates
I'm making a visual clue for the player to know where (and more or less when) an asteroid is going to enter the screen.
For this I'm using a triangle pointing at the incoming object and color ...
1
vote
0
answers
317
views
Why does this obstacle avoidance steering behaviour get stuck going left and right?
I am studying obstacle avoidance steering behaviour. So far I got arrive seek flee, and wander behaviours working, so the math should be right.
Why doesn't this avoid steer behaviour work, though? It ...