How to create prograde and retrograde markers of a projectile?

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.

This is how the landing works

The main goal is I want to create prograde and retrograde markers for a rocket and use them to guide the rocket to the landing point.



I have no idea how to script this because I’ve never done complex scripts before. I would be impressed if there is a way to make it possible.

Edit : I’ve tried with BodyPosition and it works fine, but it only pulled the rocket to the point and didn’t guide the maneuver well.

1 Like

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

1 Like

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):

2 Likes

Hello, sorry I haven’t checked the forum for a while. Your idea is interesting btw, it might help I guess.

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! :smiley:

1 Like

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.

After trying for a half year, I’ve finally figured it out how to do it. Thanks to the new post that solved the problem easily.

https://devforum.roblox.com/t/find-velocity-direction/1362947/4

Here’s an example script.

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

Result :
https://cdn.discordapp.com/attachments/868885864799957072/869874939006697492/Action_7-28-2021_4-31-12_PM.mp4

3 Likes