I’ve been trying to figure out why my canoe isn’t rotating when prompted. Every part in the model is unanchored. The density of the primary part is 100 to account for players sitting in the boat so that the boat doesn’t sink. (I’m using Skinned Mesh water and body gyros are gone now so I can’t use those ;c) I’m using angular velocity to keep the boat up and to propel it forward. If anyone can tell me how to fix this, that’d be appreciated.
(The steer value is high for testing purposes but nothing happens!)
Model Setup:
Code:
["Canoe"] = function(vehicle)
print("we good homie")
VehicleService.AdditionalMethods:WeldModelBasepartsToRoot(vehicle)
local MaxSpeed = 50
local WaterOffset = vehicle:GetAttribute("WaterOffset")
local CurrentSpeed = 0
local DriverSeat = vehicle.Driver
local BoundingBox = vehicle.PrimaryPart
local GravForce = Instance.new("VectorForce", BoundingBox)
GravForce.Attachment0 = BoundingBox.GravAttachment
GravForce.ApplyAtCenterOfMass = true
GravForce.Force = Vector3.new(0, VehicleService.AdditionalMethods:GetModelMass(vehicle) * workspace.Gravity, 0)
local MovingForce = Instance.new("VectorForce", BoundingBox)
MovingForce.Attachment0 = BoundingBox.MovingAttachment
MovingForce.ApplyAtCenterOfMass = true
MovingForce.Force = Vector3.new(0,0,0)
local SteerForce = Instance.new("AngularVelocity", BoundingBox)
SteerForce.Attachment0 = BoundingBox.SteerAttachment
SteerForce.MaxTorque = Vector3.new(math.huge, math.huge, math.huge)
SteerForce.RelativeTo = Enum.ActuatorRelativeTo.Attachment0
local function DriverChanged()
if not DriverSeat.Occupant then
MovingForce.Force = Vector3.new(0, 0, 0)
CurrentSpeed = 0
end
end
local function ThrottleChanged()
if DriverSeat.Occupant then
end
end
local function SteerChanged()
if DriverSeat.Occupant then
if DriverSeat.Steer == 1 then
print("Steer start")
repeat
SteerForce.AngularVelocity += Vector3.new(0, 10, 0)
print(SteerForce.AngularVelocity)
task.wait()
until DriverSeat.Steer ~= 1
print("Steer end")
end
end
end
DriverSeat:GetPropertyChangedSignal("Occupant"):Connect(DriverChanged)
DriverSeat:GetPropertyChangedSignal("Steer"):Connect(SteerChanged)
RunService.Heartbeat:Connect(function()
BoundingBox.CFrame = CFrame.new(BoundingBox.CFrame.X, math.clamp(BoundingBox.CFrame.Y, WaterOffset, WaterOffset), BoundingBox.CFrame.Z)
end)
end,
}