I’m making a rocket and trying to script it as realistic as possible in Roblox physics engine. The most important thing is I’m hoping to make a realistic rocket landing like SpaceX and yes this needs things about physics a lot. So, I want to make points or markers of projectile directions to get the maneuver for a rocket to land.
Talking about rocket science, this effect is called “Yarkovsky Effect” and there are 2 main directions of a projectile for a rocket. There are prograde (the direction where the rocket goes) and retrograde (the direction which is opposite the prograde).
I want to create these directions as a marker showing on the screen so I can get the maneuver for my rocket to land. I’m not good much at scripting, but I can do basics. I’ve already made my rocket system. The rocket script uses BodyForce to lift instead of BodyVelocity. BodyVelocity is easy to script this thing, but BodyForce makes the rocket more realistic than BodyVelocity. It also uses BodyGyro to do maneuvers.
hi, i like what you want to do, but i have no idea how to do it.
my question is: can a parable be useful to you or not? I recently studied parabolic motion, that’s why I’m asking you
Prograde is just the direction of the object’s velocity. Retrograde is the opposite of that.
So if you know how to use CFrames you can position a part at the rocket’s position while facing in the direction of it’s velocity, and opposite that for the retrograde marker.
That’s what I did in my system, (except there are no markers, you just use wasd to point the rocket in different directons):
I recently played around with FastCast, and you can set a “gravity” vector to simulate gravity. And inside the demo gun scripts, it states that you can have sideways gravity.
I wonder if you could fork the module and apply this gravity simulating function to your example. Then you can add markers along the calculated trajectory to achieve what you wanted. Here is how you can get the gravity force to the planet:
local gravityForce = (planet.Position - spacecraft.Position).Unit * planet.Gravity
This solution may not be performance light, since you are doing so many raycasting every frame. I hope this can help though!
This is a good script, but I was trying to get like the calculation of falling point and its direction without having a desired or already targeted point. Like Pulsarnova’s atmosphere script. There is a function that calculates the free fall time by detecting player’s altitude and speed. So, what I’m meaning is how to make markers of the object’s projectile (prograde and retrograde), just like when you play KSP or SimpleRockets 2. They useful for maneuvering the spacecraft. Sorry for bad grammar, English is not my main lauguage.
local main = -- Main part or engine of a rocket
local arrow = -- A direction arrow
while wait() do
local velocity = main:GetVelocityAtPosition(main.Position)
-- Prevent dividing by zero
local velocityDirection = velocity.Magnitude > 0 and velocity.Unit or Vector3.new()
arrow.CFrame = CFrame.lookAt(Vector3.new(), velocityDirection)
arrow.Position = main.Position
end