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
5 votes
1 answer
6k 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. ...
0xen's user avatar
  • 453
1 vote
1 answer
3k views

Calculate initial velocity for trajectory given duration, launch angle, and distance

I need my entity to go from point A to point B with a given launch angle over a given time. I've been able to figure out the initial velocity without the constraint of the launch angle, but I can't ...
Ramon Johannessen's user avatar
0 votes
0 answers
911 views

Dot product not working as expected

Recently I am learning dot product, While below code works from Unity's documentation, http://docs.unity3d.com/ScriptReference/Vector3.Dot.html ...
idurvesh's user avatar
  • 530
1 vote
1 answer
108 views

What are projection independent ways of determining whether a normal is facing the viewer?

A position v and normal n are given in world coordinates. Also there is a view matrix V for ...
Marcin Kaczmarek's user avatar
0 votes
3 answers
95 views

Velocity Relative To A Vector

So I have a velocity vector b in world space and I have a "pointing" vector a in world space. I need to know how to make the ...
Adrians Netlis's user avatar
0 votes
1 answer
2k views

Convert transform from world to local space

I have a hierarchical node system. Given a world space transform, I need to obtain the transform for a specific node in local space. My Node class has the ...
David Saltares's user avatar
1 vote
1 answer
596 views

find Vector2 libgdx

I need to get coorinates of red point. Coordinates are just for example, it would be better to see the common formula. Found code like this, but it gains wrong result.() ...
Andrei Yusupau's user avatar
0 votes
1 answer
100 views

Distance between two lines (textbook answer vs practical application)

I'm reading through "Mathematics for 3D Game Programming, and Computer Graphics" as a refresher, and leading in to some more complex real world problems down the line. However, one of the early ...
Bennett Keller's user avatar
1 vote
2 answers
62 views

Timed Line Drawing

I'm trying to program a remake of the classic Missile Command Atari game from scratch, but I've run into a problem. So I have a function that can draw a line from one point to another. I figured I ...
Praefervidus's user avatar
1 vote
1 answer
772 views

Display mesh in front of camera

Im trying to display a mesh in front of the camera and FACING the camera ( I'm developing an small editor in wpf using helix3d). Pretty much something like this question I load my mesh into a ...
elios264's user avatar
  • 131
5 votes
1 answer
2k views

How do splines work?

I've been beginning to work with different kinds of splines (e.g. Bezier, Hermite, B-splines) in some of my work with computer graphics and I am trying to get a grasp of how they work (mathematically ...
loremIpsum1771's user avatar
1 vote
0 answers
68 views

Is studying Alternate Coordinate System required game development? [closed]

I don't know whether or not this question is fit for Gamedev.Stackexchange, but I would like to know :- I am new to Linear Algebra. I only want to study those parts of Linear Algebra which would ...
anonymous's user avatar
  • 514
2 votes
0 answers
406 views

What is the most efficient way to determine collision path

I am trying to create a game in which I need to know if two objects will collide in the future, and when. I have both object's position, radius (they are circles) and velocity. A specific example of ...
DSchana's user avatar
  • 121
6 votes
3 answers
4k views

Most efficient way to get the world position of the 8 vertices of a Box Collider

What I am looking for is the most efficient way to get the world position of the 8 vertices of the Box Collider of a freely rotated Game Object. I cannot use collider.bounds since object is rotated, ...
Louis15's user avatar
  • 569
0 votes
1 answer
154 views

In unity, how do I rotate a vector in relation to the player?

I am making a radar script in a unity FPS game project I am making for class. I already have a working example of a radar script that works in relation to the player's position. However the rotation ...
needoriginalname's user avatar
0 votes
1 answer
793 views

Tween - keeping a constant velocity at different distances

I am using a tweening library to move my units around. The problem is that the speed varies depending on the distance that the unit has to move because of the tweening: ...
Oliver Schöning's user avatar
1 vote
1 answer
61 views

Adjust postion only in X axis

I have two game objects named A and B, just as follows: I want to move object B to this ...
frogatto's user avatar
  • 191
0 votes
0 answers
146 views

Project 2d click/touch onto 3d plane

I have a 3d scene that contains an infinite plane that is NOT parallel to the camera (so every screen coordinate corresponds to a point on this plane- in other words, there are no possible invalid ...
Phildo's user avatar
  • 292
1 vote
0 answers
136 views

convert 2d pt into non-affine coordinate system

Say I have a coordinate system that goes from (0,0) to (1,1). We'll call this screen_space. ...
Phildo's user avatar
  • 292
1 vote
1 answer
124 views

XNA Line to Rectangle Collision return first pixel

I have the following code: ...
user2072826's user avatar
3 votes
1 answer
130 views

How to calculate height of a thought line over a known spot in 3rd person view?

Assuming a player object with third-person-view is in a 3d room and the center of the screen has a dot - let's call it "cursorTarget". All I have is the position of the player, the position 5 meters ...
Stacky's user avatar
  • 395
1 vote
2 answers
10k views

How to find the "up" direction of the view matrix, with GLM

Using OpenGL and the GLM matrix library, I want to translate my camera relative to the world coordinate system. This requires me to compute the necessary view matrix. To initialise the view matrix, I ...
Karnivaurus's user avatar
3 votes
1 answer
111 views

Finding coordinate in radius

Hello i have two points (Vector3) A and B. And have a radius r How can i find a coords of ...
Glebka's user avatar
  • 131
-1 votes
2 answers
131 views

How to get a pleasant path accelerating to a point

I am having trouble moving an object to a target position with a maximum acceleration limit. If i just accelerate towards the target the object will fly in a doughnut a few times before hitting the ...
t123's user avatar
  • 703
-1 votes
1 answer
94 views

How to calculate coordinates of ball when collided with a wall?

I'm developing a game like bubble shooter and need to implement bounce of ball off the vertical wall. I have the following inputs: Starting position of bubble: ...
Erik's user avatar
  • 103
0 votes
2 answers
155 views

How does collisions caculates when developing game in Build an HTML5 Game book

I don't understand author's logic when calculating collisions between two circles (bubbles). Here is the Calculating collisions section. Author writes: The bubble being fired follows a set of ...
Erik's user avatar
  • 103
0 votes
1 answer
2k views

How to calculate normal vector of a Bézier curve?

How I can calculate the normal vector for two dimensional Bézier curve? (I have the control points of the curve in the x y plane)
rasha's user avatar
  • 1
11 votes
5 answers
4k views

How do I correctly project a point behind the camera?

I am making a 3D game in which I put an exclamation marker above points of interest. In order to find out where in the 2D screen should I put my marker, I am manually projecting the 3D point where ...
Panda Pajama's user avatar
  • 13.4k
4 votes
3 answers
5k views

Detect if two objects are going to collide

I am working on a car game where I am to create an AI. In the game there are other cars and a few objects moving around that I do not want to crash with, I have the speed, position and direction of ...
Paze's user avatar
  • 43
1 vote
1 answer
317 views

CGVectorMake to move SKNode at a certain speed towards the middle of screen?

I am trying to launch my ball sprite towards the middle of the screen at the same speed every time I launch it. ...
FryDay's user avatar
  • 131
1 vote
1 answer
149 views

How to figure out a vector based on 2 points that add up to a certain value

I am writing a game in which I am representing a velocity with a vector. I have a starting point and a point that I want the object to move towards at a certain speed. (I need the resulting vector's x ...
FryDay's user avatar
  • 131
1 vote
1 answer
859 views

Problem with 2D matrix transform og shapes

I have set myself onto the task of creating a class BaseObject, which represents a graphics object with an associated shape as the member variable shape, which is a pointer an object Polygon. I'll ...
Tom V M's user avatar
  • 23
0 votes
1 answer
418 views

How to represent ray and line segment in parametric form?(Visibility)

I am trying to implement this algorithm but am not sure how I am supposed to represent my ray and my line segments(walls). For the r_px/r_py do I just use the position of the light? For the r_dx/r_dy ...
Moo's user avatar
  • 352
16 votes
3 answers
31k views

How can I reverse the effect of a transformation matrix?

I have recently been working on a game with using OpenGL and C++ through GLFW. In the game I have an airship with a turret mounted on it. The airship moves around in world space coordinates and the ...
user1291510's user avatar
5 votes
2 answers
4k views

Mixing Perspective and Orthographic Projections?

I'm going to start with some background, so jump to my question at the bottom for the TLDR version. Problem: In a Japanese 4gamer article (english translation via Chev on Polycount) explaining some ...
MrKatSwordfish's user avatar
0 votes
1 answer
80 views

trasformation matrix for model's bones

I was developing an fbx converter for legend of grimrock object model (www.grimrock.net), I just wanted to get the animations cause the rest has been converted by others' tools. I was reading all of ...
kaomao's user avatar
  • 3
5 votes
3 answers
9k 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 ...
user51213's user avatar
6 votes
2 answers
4k 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 ...
Snake22's user avatar
  • 63
1 vote
0 answers
624 views

Closest distance from 3D point to vector line

First let's have a look at my little drawing: I have an origin point p1 defined by x, y and z co-ordinates, and a vector v given by x, y and z magnitude. I also have an arbitrary point, p2, given ...
ev0lution's user avatar
  • 119
23 votes
3 answers
4k views

Are there 3D projections other than orthographic and perspective? [closed]

The question is pretty much in the title. Are there notable 3D projections other than orthographic and perspective that could be used in a 3D system such as OpenGL? In particular, are there any that ...
Joey Eremondi's user avatar
1 vote
2 answers
3k views

How to implement a simple bullet trajectory

I searched and searched and although it's a fair simple question, I don't find the proper answer but general ideas (which I already have). I have a top-down game and I want to implement a gun which ...
alezvic's user avatar
  • 111
0 votes
1 answer
89 views

Understanding dot notation

Here's my interpretation of dot notation: a = [2,6] b = [1,4] c = [0,8] a . b . c = (2*6)+(1*4)+(0*8) = 12 + 4 + 0 = 16 What is the significance of 16? ...
Starkers's user avatar
  • 961
1 vote
0 answers
2k views

How to rotate a line in 3d space?

I am trying to figure out direction vectors of the arrowheads of an arrow. Basically I'm given a normalized direction vector ...
omega's user avatar
  • 111
0 votes
2 answers
7k views

How can I get a direction vector from a an Euler angle?

Im trying to get a directional vector from an euler angle. But im not getting how to do it. This is what i got so far. ...
Daarwin's user avatar
  • 829
41 votes
3 answers
96k views

How can I find the perpendicular to a 2D vector?

I'm making a top down game where the player moves forwards towards the position of the mouse cursor. As part of the player's movement code, I need to determine a vector that is perpendicular to the ...
Jonathan Dunn's user avatar
2 votes
1 answer
11k views

Gerstner wave function simplified?

The gerstner wave function is a commonly used method to calculate waves and simulate water in video games and movies or most 3d simulations. It is however quite complex so it is very hard for young ...
user avatar
2 votes
1 answer
1k views

3d Water Simulation formula questions

I have created a Grid: At each point along the grid, is a vertex (Intersection Points): Each of these points has an x,y,z position. Vector3f(x,y,z). In an attempt to animate the grid into a group of ...
user avatar
-1 votes
3 answers
3k 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. ...
Daarwin's user avatar
  • 829
4 votes
2 answers
874 views

Angle between two planes

I have two triangles in 3d space which share 1 edge and I would like to determine if the angle between their normal vectors is "uphill" or "downhill". In other words, if you set one flat, would the ...
tgrosinger's user avatar
-1 votes
1 answer
338 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 ...
Reanimation's user avatar