--Create attachments and contraints for function

local parts = getParts(boat)
local centerOfMass, totalMass = GetCenterOfMass(parts)

local center = Instance.new("Part")
center.Anchored = true
center.Name = "CenterPart"
center.CanCollide = false
center.Archivable = false
center.Size = Vector3.new()
center.Transparency = 1
center.CFrame = GetRotationInXZPlane(seat.CFrame - seat.CFrame.p) + centerOfMass
center.Parent = boat

local attachment = Instance.new("Attachment")
attachment.CFrame = center.CFrame
attachment.Position = Vector3.new()
attachment.Parent = center

local vectorForce = Instance.new("VectorForce")
vectorForce.ApplyAtCenterOfMass = true
vectorForce.Attachment0 = attachment
vectorForce.Force = Vector3.new()
vectorForce.RelativeTo = Enum.ActuatorRelativeTo.Attachment0
vectorForce.Parent = center

local torque = Instance.new("Torque")
torque.RelativeTo = Enum.ActuatorRelativeTo.Attachment0
torque.Attachment0 = attachment
torque.Torque = Vector3.new()
torque.Parent = center

totalMass = totalMass + center:GetMass()

