Converting Magnitude into Lightyears?

Working on a space game and am currently looking for a way of converting Magnitude into Light years?

I know the basics of getting Magnitude, but for a space game spread out is it best for
1LY = 1,000 studs?

But then it’s a matter of converting this?

Distance = (Ship.CFrame.p - TargetPos).Magnitude

LightYears = Distance / 1000

Am I on the right track?

3 Likes

You have the right formula for converting from studs to your definition of light years.
When it comes to saying whether or not 1LY = 1000 studs is a good definition depends on the game itself and is just something you’ll have to figure out I think. Seems like a reasonable number though.

2 Likes

A simple formula to know is that 5 centimeters in real life is 1 studs.

Now that will get you a crazy number like 2.8697827, so you want to round it.

Distance = (Ship.CFrame.p - TargetPos).Magnitude

LightYears = Distance / 1000
local rounded = math.floor(LightYears + 0.5)