pci coordinates will only return latitude, longitude, and altitude relative to the surface of a celestial object
i need the position of the craft relative to Vector3.new(0, 0, 0)
if you’ve used roblox lua, you’d probably know where i’m getting at. if not, at least tell me how to get the distance between two objects in vizzy
how do i get the position of the craft relative to the universe?
Tags
Question5 Comments
- Log in to leave a comment
-
5,243 LeMagicBaguette
Best bet is using the central body and trigonometry.
For instance, a coordinate of (84,-160,35000) will translate to (-1251,-3437,34808) if we assume that a coordinate above (0,0,x) represents the direction of the x axis and (90,x,y) represents the z axis. Note that this original vector is the PCI coordinates of the player craft added to its celestial body's solar position.The z value is taken from the sin of the latitude angle multiplied with the PCI vector magnitude. The x value is taken from the cosine of the latitude multiplied by the result of the absolute value of the cosine of latitude multiplied by the magnitude (we’ll just call this w), and y is taken from the sine of the latitude multiplied with w.
-
2,237 TomKerbal
O.k. I don't know "toblox lua" sorry, only Vizzy. There you can subtract 3D-vectors simply by using the " - " operator.
-
9,400 RudimentaryCheezit
@TomKerbal
in roblox lua, the distance between two vectors is:
(Vector3.new(x, y, z) - Vector3.new(x, y, z).Magnitude -
2,237 TomKerbal
Nav/Position and Nav/TargetPosition given in PCI coordinates.
Coordinates of Center of Mass (CoM) wrt Celestial Body center (which is the same as CoG, Center of Gravity here). PCI is Planet-Centered Inertial Frame of Reference.
Trivially the magnitude of the vector difference is the distance between them.
Oh, you just want distances.
To do that, you need to add your position to the solar position of your celestial body; this is value x. Value y is the target plus their celestial body’s solar position. You will find the dist function in the vector operations function. Slap in x to one side and y to the other, and this should yield absolute distance.