I have been looking this up for weeks. I have no background in physics, and the Greek makes it very confusing to interpret.
I am making a game exclusively in MySQL, mainly for the challenge. The concept is an idle space RPG, kind of like EVE online but meant to be completely automated...
So, the map is in 3d, with x,y,z representing each dimension. I have the formula for finding the distance between two points in MySQL:
If you take the distance and divide it by the speed, we can get the time that we would arrive. The question is, how do you find out where the object is mid-flight?
Find the distance between two points:
create table stars (id int auto_increment primary key, x decimal(65,8),y decimal(65,8), z decimal(65,8)); insert into stars (x,y,z) VALUES ("0","0","0"),("1000.00","3000.00","2500.00"); set @id = 1, @x = (select x from stars where id =@id), @y = (select y from stars where id =@id), @z = (select z from stars where id =@id); SELECT (POW((X-@x),2)+POW((Y-@y),2)+POW((Z-@z),2)) as distance FROM stars where id = 2;
The travel_time would be distance/speed. Without taking into acceleration or gravity, how do we determine the position of the object when it is halfway through its flight?
I believe this is the formula: