Weird Boat Physics

You can write your topic however you want, but you need to answer these questions:

  1. What do you want to achieve? Keep it simple and clear!
    A simplistic boat system.

  2. What is the issue? Include screenshots / videos if possible!
    The system I’ve developed thus far works well enough until a secondary player approaches the driver, then the boat insists on flinging itself as far away as humanly possible.
    https://medal.tv/games/roblox/clips/8Vw4okZtQDDnH/d1337G0Fu5TA?invite=cr-MSxZVXMsMzM4Nzk1OSw (Thanks icke.)

  3. What solutions have you tried so far? Did you look for solutions on the Developer Hub?
    I’ve attempted to set NetworkOwnership and disable player collisions with each other entirely as potential solutions, both of which failed. I have searched the Developer Hub with lack of success.

Code:

local boat = script.Parent
local boatDriverSeat = boat.Driver

local steerConnect = nil
local throttleConnect = nil

boat.Union.BodyAngularVelocity.MaxTorque = Vector3.new(0, boatDriverSeat.Torque, 0)
boat.Union.BodyVelocity.MaxForce = Vector3.new(boatDriverSeat.MaxSpeed, boatDriverSeat.MaxSpeed, boatDriverSeat.MaxSpeed)

boatDriverSeat:GetPropertyChangedSignal("Occupant"):Connect(function()
	local driver = boatDriverSeat.Occupant
	if not driver then
		print("Sad!")
		boatDriverSeat:SetNetworkOwner(nil)
		boat.Union:SetNetworkOwner(nil)
		steerConnect:Disconnect()
		throttleConnect:Disconnect()
	else
		local player = game:GetService("Players"):GetPlayerFromCharacter(driver.Parent)
		if player then
			boatDriverSeat:SetNetworkOwner(nil)
			boat.Union:SetNetworkOwner(nil)
		end
		
		steerConnect = boatDriverSeat:GetPropertyChangedSignal("Steer"):Connect(function()
			print(boatDriverSeat.Steer)
			
			boat.Union.BodyAngularVelocity.AngularVelocity = Vector3.new(0, (-1 * boatDriverSeat.Steer) * boatDriverSeat.Torque * boatDriverSeat.TurnSpeed, 0)
		end)
		
		repeat -- Plan on switching to VelocityLine
			task.wait(.1)
			boat.Union.BodyVelocity.Velocity = boat.Union.CFrame:VectorToWorldSpace(Vector3.new(boatDriverSeat.Throttle * boatDriverSeat.MaxSpeed,0,0))
		until not boatDriverSeat.Occupant
	end
end)

Currently losing my mind trying to get my boats to work well when colliding with land or players. As you say, everything is PERFECT, until you run into someone and go FLYING.

Roblox physics are so hard to work with, you either do too little force and your boat flips or lifts up when you hit something, or you turn it higher and it goes flying away with immense force. There seems to be no in between. Pretty soon I might smash something… xD

Try increasing the density of your boats.

Putting the density to maximum, for all parts, makes a very slight difference; but the issue remains. Too little force, and the results are undesirable. Add more force and the results are worse than undesirable. Parts with body forces moving them do not collide with stationary objects in a predictable or controllable manner.

Edit: I have also experimented with friction, elasticity, and weights for both. Nothing resolves the issue I am experiencing, and many other games experience. I may have to show video footage to explain this more thoroughly.

1 Like

Please do. It will help show the issues easier.

We ended up adding invisible walls surrounding every single land mass in the game and set the custom physical properties to 0 elasticity and friction. I added the players to a collision group with the walls so that they don’t collide, only boats do. This solution has completely resolved my problems; it’s not the most reasonable solution but it’s by far the most effective.

If it’s going to lead to any changes to Roblox, I am willing to get some recordings of the behavior before and after. Otherwise, seems pointless now.

Thanks anyways!

1 Like