BodyThrust Wide Turn

Hello, I’m trying to script a jet-like system, with two thrusters located at the back of the jet, each of them containing a BodyThrust. The problem I have arrived upon is when you turn the jet, which it does using a BodyGyro (It turns slow which is the point for this type of jet), but the thrust is not applied directly in the new direction, instead it floats in the original direction for about 4 - 8 seconds before it finally starts moving in the new direction. How do I fix this?

Video:

Summary -
How to I make the BodyThrusts immediately apply force to the new direction instead of gliding for a few seconds before applying the force on the new direction.

Anti - Gravity for the jet was used.

I can provide code if you need it.

Looks like an issue with momentum since it keeps going in one direction. You’ll need to find a way to change the direction of the velocity then towards where the plane is facing.

1 Like

What is the Density of the Parts you are using? As @dthecoolest mentioned, momentum can be a factor. If you reduce the mass of the jet then its momentum will be reduced and the changed thrust will be more effective.

1 Like

You need to apply some force towards the centre of the circular path you want to take.

This is what the generated lift from the wings would be doing, and it’s needed to create a circular path.

Google centripetal force, or watch this video to understand airplanes turning: https://youtu.be/mww8DqC0QKk

1 Like

@Scottifly I use the standard value that Roblox creates. The total mass of the jet is 200k.

@BanTech Okay, I’ll make sure to check out that video. Would something like having a bodymover that always relative to the world uses a force in the direction of the turning center?

@dthecoolest Yea, I assumed I would need to do something like that.

You can use the BodyThrust you already have, you’ll just be applying a force in the relative X axis when turning.

The magnitude of the force to apply perpendicular to the aircraft can be calculated based on how tight you want the turn radius to be, which in turn can be calculated by the rate of change of heading.

If your heading changes at 4° per second, you are travelling at 30 studs per second, and your mass is 1000, for example:

m = 1000 -- mass
V = 30 -- studs/s
w = math.rad( 4 ) -- 4 deg/s, in rad/s
r = V / w -- radius of path, in studs
Fc = m * V * w -- centripetal force required

You can calculate mass by summing up BasePart:GetMass() on all your parts, unions and meshes in the aircraft. You should know velocity and angular velocity as you are controlling the jet already.

Calculate this in real-time so that the force can appropriately change if the aircraft accelerates or decelerates through the turn.

Ensure angular velocity, w, is negative if turning left and positive if turning right. The rest of the signs should work themselves out from there, assuming your part with the BodyThrust is oriented as expected.

BodyThrust.Force = Vector3.new( Fc, BodyThrust.Force.Y, BodyThrust.Force.Z )
1 Like

You could also select some of your ‘heavy’ Parts and check the box in Properties marked ‘Massless’.

If it suits your purposes you can use a bodyvelocity and just make it go in whatever direction the jet is pointing and then increment the target velocity as the jet accelerates. A jet only running off of bodythrusters with no force pushing back will also continue to accelerate forever if you dont change direction so you might want to watch out for that.

I’ve actually thought of a new solution to this which could work better with the inaccuracies you find ingame. The Centripetal force is just defined as a force to keep something on a circular path. So we could find out how fast the object is rotating (with RotVelocity) and then say the velocity is supposed to stay in the same direction relative to the part’s CFrame. Knowing the size of a TimeStep and the RotVelocity we can then calculate the future CFrame velocity and then the required force.

Here’s what I came up with in code:

local SeatOrientation = Seat.CFrame-Seat.CFrame.p
local RotVelocity = Seat.RotVelocity
local Velocity = Seat.Velocity
local RotSpeed = RotVelocity.Magnitude
local RotAxis=RotVelocity.Unit
local RelVelocity=SeatOrientation:Inverse() * Velocity
local FutureCFrame=CFrame.fromAxisAngle(RotAxis,RotSpeed * dT) * SeatOrientation  
--dT is a small timestep you get from a while loop or stepped event etc.
local TargetVelocity=FutureCFrame * RelVelocity
CentripetalForce=Mass*(TargetVelocity-Velocity)/dT