Help with VectorForce as Thrust (acceleration of plane)

Hello,

I am working on a Plane System that is based off of Sleitnick’s Biplane. Currently I am working on the Thrust portion of the plane. After testing, it appears my plane doesn’t move until close to -43000 on the Z axis of the VectorForce. My issue is, once it crosses that mark, it accelerates super, super fast. Here are some code snippets that might help with figuring out the problem:

Throttle: A value between 0 and 1.
PlaneWeight: Total Mass of Plane Model, is currently around 400.
MaxEngineForce: Set to 300… not sure what to set it too with this issue.

*Damping*: A module created by Sleitnick
	local damping = Damping.new()
	
	damping.P = NUMBER
	damping.D = NUMBER
	damping.Position = Vector3
	damping.Goal = Vector3
	
	damping:Update()      [Returns Vector3 position]

velocity += P * ( (target - current) + D * -velocity );
current += velocity * dt;
Credit: http://www.gamedev.net/topic/561981-smooth-value-damping/
Flyer:Update (called on Heartbeat)
function Flyer:Update(plrMouse)
    local t = realThrottle
	if (t > 0) then
		t = math.max(0.05, (realThrottle - 0.5) * 2)
	end
    self.Mover.Force = V3(0,0, (t * self.PlaneWeight * -MAX_ENGINE_FORCE))

end
Flyer:UpdateControlls (called on RenderStepped)
local lastControlUpdate = tick()
function Flyer:UpdateControls(plrMouse)
    local now = tick()
	local dt = (now - lastControlUpdate)
	lastControlUpdate = now

	throttleDamp.Goal = V3(self.Throttle, 0, 0)
    local controlInputs = controlDamp:Update()
    local throttleInput = throttleDamp:Update()
	realThrottle = throttleInput.X
    
    if (realThrottle < 0.001) then
		realThrottle = 0
	end
end
ClientPlane:ReadInput (called on Heartbeat)
-- Update throttle:
throttle = ((w ~= s) and (w and 1 or -1) or 0)
	if (throttle ~= 0) then
		local t = flyer.Throttle + (throttle * dt * 0.2)
		t = (t < 0.5 and 0.5 or t > 1 and 1 or t)
		flyer.Throttle = t
		planeGui:UpdateThrottle(t)
	end

Note: My plane is scaled down to roughly the size of a character with the realistic workspace gravity settings. I am applying this VectorForce to a mass-less part within the plane.

You can test in person here: Plane Game - Roblox
Note: (W/S for Throttle, A/D for Rudder) - Drag and Lift aren’t implemented yet.
UI shows the Z Value of the Force and the Throttle.

If any more information is needed, feel free to let me know!
Thanks in advance!

2 Likes

This might be your problem: AlarmClock - Wake up sleeping BaseParts and prevent Sleep

1 Like