Possible to add a debris to temporary orbit around a planet?

What I want to achieve is I want to know if it’s possible to make any type of object which orbits around the planet (moon) and some crashes into it? (asteroid or meteoroid). To let you know, I’m not asking for a full script, It’s optional to send a full script. But I mainly want explanation on how to do it so I can try scripting it. I am not also asking for a simple script where it uses simple velocity to orbit around the planet, What I want and know is getting the mass and use velocity, but I don’t know how to do it and I can’t find anything useful from the other topics.

Here is a tutorial on constraints

If you need a bit more, here is a tutorial on body movers. Note that these are older, but I’m not sure if they are officially depreciated.

How will attachments and constraints help?

Actually, it may not help, but I just always include that because it’s kind of a successor to body movers (I think). Body movers will probably be more relevant.

Hello XxAkaDuyxX.

I have been thinking about this problem since I viewed another post about rockets made earlier today. In that post, someone posted an example of a physics simulation they made and what they did was code a physics simulation using CFrames and Renderstepped. If you plan to make an orbit I suggest doing this, fundamentally you can think of an orbit as an object moving tangent to a surface and moving towards that surface at a fast enough rate to make it so they do not collide with the surface. You can use GetMass to put into gravity and acceleration formulas but to find the correct acceleration to not crash into the orbited object you will have to figure that out yourself.

You don’t even need a script, the new body movers calculate the inverse square law maths for you and they even have an example in the place file given.

All the things required are one line force Instance in the satellite and two attachments to orbit around the planet.


But every time they complete an orbit, it’s going to same direction, sometimes a satellite, they would slowly orbits closer to the Earth and some moons orbits further every time they made an orbit.

Sometimes the small objects, depending on their mass, they would orbit for a while or sometimes just crashes into the planet, what i’m saying is a realistic orbit.

Hey guys, i changed the title. This is what i meant, a debris can randomly orbit to an unexpected orbit

Ah, I remember this physics exam question before. The reason why the orbit of the satellite changes is because of the change in orbit velocity, where because of air friction the satellite will eventually go closer to the earth, and yeah crash.

To replicate and another physics phenomenon this you will need to add an additional friction drag force in the form of a vector force opposite to the direction of the satellite motion in order to achieve your desired realistic orbit. So for this to translate into the script you can definitely get the direction of the satellites motion via the .Velocity property of so to apply the opposing air friction force in.

local velocity = part.Velocity
local directionOfAirFrictionForce = -velocity.Unit

I don’t think it’s exactly correct but it should be simple enough to do. If you want it to be more correct and realistic then ya gotta do the physics and maths which there are plenty of resources online to do so from.

What I can say is that is an orbit that is made manually, I want to make it so like for an example, an asteroid is going to the planet by a body mover, if the speed of the asteroid is fast enough, it will just crash into the planet, if it’s slower then it can make a temporary orbit and slowly falls and crashes to the planet. It also depends on where it’s facing to.

I forgot to reply to u once again

I still need help, but if you’re new to the post, read at message 10 and you will know what I want.

Hey guys, I still need help here. I want explanation on how to do it.

I still need help, can someone reply?

Use the gravitational force formula for a straight forward approach, however if u want realism change the velocity depending on its position and the planet. See vis viva equation.

I have no idea on using the formula for it so how can I do that?

Sure I use non euler approach. You can hear my talks on it here

But in general what you are doing is applying the formula to a variable then getting the difference in that to the players velocity / body force already then applying that delta change. You can also just make it like explicit in a sense but thats how i do it. You can see my implementation here spacey spacey.rbxl (24.0 KB)

On the topic of how to use the vis visa like I said apply the equation to get your initial velocity then set that to your asteroids dependent on their position. This method requires you to have no gravity however I have thought of a solution while typing this. Don’t explicity set your velocity like I said but rather apply a delta change to it by adding the speed the formula says to do by subtracting it from your current speed then getting the difference and adding that. From there you add also a force relative to the y axis (world axis aligned, the one the player experiences due to gravity) on that. It is simply equal to what we learn in high school with mass * acceleration. Acceleration being workspace.Gravity and the direction for that since I describe direction in the videos is not exactly what you thought. Since it is axis aligned we can simply call the y axis, again since it is axis aligned. Make sure to reset the force vectors to be relative to the world units if you use like VectorToObjectSpace or smth

1 Like

Does the vis viva equation changes the planet’s orbit’s shape? Is it also possible to do this if the planet is bigger and further, and even slower?

The vis visa just tells how fast it should be going initially in order to get a certain orbit, yes. To add on you will eventually leave the sphere of influence if you go far enough but you can just increase the planets mass ig.