So I recently made a train game, and had the big brain idea of "Hey, let’s used motor6Ds for the train wheels. since i can just set them on a velocity,
and it works! most of the time.
but for some reason, even though these are being made locally. they still refuse to render their updates when part of a train that the client doesn’t have network ownership over. and when these happens. every attached fails to update their motor6d animations. Including player animations.
Here’s the code that creates the motor (client side)
module.Wheel = function(P1,P2,TrainModel) local W = Instance.new("Motor6D") W.Part0 = P1 W.Part1 = P2 local CJ = P1.CFrame:PointToObjectSpace(P2.CFrame.p) local C0 = CFrame.new(CJ*Vector3.new(-1,-1,-1) ) W.C0 = CFrame.new()*CFrame.fromEulerAnglesXYZ(0,1.57,0) W.C1 = C0*CFrame.fromEulerAnglesXYZ(0,1.57,0) if not TrainModel:FindFirstChild('Wheels') then local WF = Instance.new('Folder') WF.Name = "Wheels" WF.Parent = TrainModel end W.Parent = TrainModel.Wheels return W end
here is the code that is updating them (also client side, run on a floating update rate. close wagons are every frame and far wagons are every other second)
local TrainVel = math.abs(TrainV) local RotV = (TrainV/WheelCircumferance)/6.2831/2 for i,v in pairs(Wheels) do v.CurrentAngle = v.CurrentAngle % 6.2831 v.DesiredAngle = math.sign(-RotV)*10000000000 v.MaxVelocity = math.abs(RotV) end
I’ve tried swapping to a motor, the same update function is turning the main rods (which are skinned mesh, and animation driven) so we know it’s calculating the train velocity correctly. so what gives? and why does it also freeze the cab animations (will post video once i capture it)
cab issue: same thing. when it happens in motion it will freeze when the wheels stop, and unfreeze when they start turning again