Math problem with coordinates, how would I calculate a certain coordinate?

304 Views Asked by At

I am building a system for FiveM, by using LUA. For that system I need a specific coordinate.

Vehicle System ingame

The drawing of coordinates

I know coordinates A, B, C, D, E, P. But now I want to know point G.

How would I do that with math, and how would I do that in LUA ?

1

There are 1 best solutions below

2
Egor Skriptunoff On BEST ANSWER
-- P, E, D - vectors
local EP = P - E
local nED = norm(D - E)
local G = P - (EP.x*nED.x+EP.y*nED.y+EP.z*nED.z)*nED