Spaceship VectorFoce

i have a problem and can’t find how to solved it
Workspace is in 0 Gravity

the thing i want to achieve is:

pressing D
spaceship move (with vector force)
when releasing D
(i want it to go back to a full stop)

local function onChanged (property)
	if property == "SteerFloat" then
		if seat.SteerFloat ~= 0 then
			if Stoping then Stoping:Disconnect() end
			vectorForce.Force = Vector3.new((seat.SteerFloat * ship:GetMass() * shipHandeling),0,0)
		else
			--How to Stop this Ship back to no Velocity?
			--Stoping = RunService.Stepped:Connect(breakingShip)
		end
	end
end



--I did try to reapply the same force back to stop but then it just shoot the ship pass the zero velocity point

local function breakingShip (time, step)
	local increment = RATE_PER_SECOND * step
	print("Stepped")
	--find a way to visualize when the Velocity is closed from (0,0,0)
	if Linearvelocity <= zeroThreshold then
		print("Stop NOw!!")
		Stoping:Disconnect()
	else
	Linearvelocity = ship.AssemblyLinearVelocity
	vectorForce.Force = Linearvelocity * ship:GetMass() * breakingForce
	end
end

any logic or path im missing?
Thx for the advices

1 Like