Moon.CFrame = earth.CFrame * CFrame.Angles(0, moonAngle, 0) * CFrame.new(moonDistanceFromEarth, 0, 0) RunService.RenderStepped:Connect(function(dt)Įarth.CFrame = sun.CFrame * CFrame.Angles(0, earthAngle, 0) * CFrame.new(earthDistanceFromSun, 0, 0) Local moonRotSpeed = 90 -arbitrary, degrees per second Local earthRotSpeed = 10 -arbitrary, degrees per second Local earthAngle, moonAngle = 0,0 -tracks the current rotation Local RunService = game:GetService("RunService") Local moon = workspace:WaitForChild("Moon") Local earth = workspace:WaitForChild("Earth") I’m positive this isn’t the only solution, nor is it necessarily accurate to how planets ACTUALLY move (I’m not a physicist), but I think this is what you were asking for: local sun = workspace:WaitForChild("Sun") I’ll take a moment to explain it so you can learn something from it. My approach to this problem was to calculate two different angles to get the position of each planetary body.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |