I can create an orbit within a flat plane, that shouldn't be too much of a problem since all I really need to do is use the parametric equation for a circle/oval and position the orbiting part accordingly, like so:
1 | while wait() do |
2 | local t = tick() * 2 * math.pi * X -- X is the time of orbit |
3 | local o = Vector 3. new(math.cos(t), 0 , math.cos(t)) -- or any combination of the two |
4 | part.CFrame = CFrame.new(mainPart.Position + o * R -- R is the separation |
5 | end |
How would I create a circular orbit out of the plane?
1 | while wait() do |
2 | local t = tick() * 2 * math.pi * X |
3 | local tilt = math.rad( 15 ) |
4 | local o = Vector 3. new(math.cos(t), math.cos(t) * math.sin(tilt), math.cos(t)) |
5 | part.CFrame = CFrame.new(mainPart.Position + o * R) |
6 | end |
This was the best I could come up with. But since I lack the knowledge about orbits and such I think this might simply not work. If you provide more context I might be able to figure it out.