Looking to recreate RocketPropulsion physics

Hello, I’m looking to create a homing missile with the new physical constraint tools Roblox added. Because the old ones got depracted (which I think was a dumb idea, because they worked just fine and were simpler to use), I find myself with the LineForce system.
The issue is as follows: how do I make a system that has speed limits and no gravitational influence?
LineForce has none of those features built in, are there other tools that can allow me to bypass that?
Or should I just stick to the good old RocketPropulsion, at the risk of it becoming increasingly unsecure/unstable due to the lack of updates?

1 Like

I’m not entirely sure what you mean by the first part of your question.

However for your second part you can use a VectorForce as the reaction for gravity.

Gravity is acceleration. so we can get the weight by multiply by mass using the Formula F = ma where m is mass and a is acceleration.

Then you set the upwards Vector force to that number. You need to make sure the vector force is acting relative to the world and that the attachment is at the CenterOfMass. You can get the center of mass by doing

Attachment.WorldPosition = BasePart.AssemblyCenterOfMass

Then you can apply the force.

local Weight = BasePart.AssemblyMass * workspace.Gravity
VectorForce.Force = Vector.yAxis * Weight --acting upwards ofc.

One word of advice is to not use BodyMovers anymore. They aren’t as customizable and you can usually get more complex behaviour. With line forces you can do N Body simulation or even use them in boids separation.

3 Likes

in rocket propulsion you had a maxspeed value
it couldn’t exceed this value, even if the maxforce was sufficient
now with lineforce it just keeps on accelerating
(and thanks for the no gravity thing!)

It seems to me that RocketPropulsion uses a PID controller. So you will need to have some code running in the background.

I actually made a controllable missile. (Rockets don’t actually have guidance systems). I used LinearVelocityContrstraint along with AlignOrientation. So the best way is to do this:

  • LinearVelocity.Velocity to (0,0,-X) where X is the speed of missile in studs.
  • AlignOrientation CFrame.lookAt() to the target

thi code

local AlignOrientation = script.Parent.AlignOrientation

while true do
	local dt = task.wait()
	AlignOrientation.CFrame = CFrame.lookAt(script.Parent.Position,workspace.Target.Position)
end

So then:
Acceleration would be controlled by LinearVelocity.MaxForce (Keep the antigravity force on too)
Velocity would be controlled by the LinearVelocity.Velocity.Z (NUMBER MUST BE NEGATIVE TO GO FORWARD)
AngularVelocity would be controlled by AlignOrientation.MaxAngularVelocity
AngularAcceleration would be controlled by AlignOrientation.MaxForce
AngularJerk would be controlled by the AlignOrientation.Responsiveness

Remember that Acceleration scales with mass. If you change the size of the rocket you will have to change the size of your force. Remember if you want to set acceleration directly you can use the formula F = ma sub m for the mass of rocket and a for desired acceleration.

https://gyazo.com/30064999278c2ae1937e033f26551c2d

Happy coding.

2 Likes