I have an assembly line/factory whatever you want to call it that uses Welded parts and TweenService, and I’m trying to look into smooth and performance friendly options to keep a player’s Character on the platform whilst it’s moving
While the system I have works, it has some slight performance and visual drawbacks. The camera always tends to be slightly offset when the platform is in motion, this is extremely apparent when fast and sudden movements happen, the camera tends to offset.
Several solutions have gone into testing, setting the velocity of the character, using different RenderStepped functions, and using :BindToRenderStep with a priority ranging between 0 and 300, which hasn’t helped. I’ve played games like Jailbreak where they have a similar system to keep your character on the train/plane, which theirs works absolutely flawlessly. I’ve read the DevForum post about the Jailbreak Train Platform Script, it’s the same one I’m using now which has the issues above.
local function BindCharacterToModels()
local RayCast = Ray.new(RootPart.CFrame.Position, Vector3.new(0, -50, 0))
local Hit, Position, Normal, Material = workspace:FindPartOnRay(RayCast, Ignore)
if Hit and Hit.Name == "HitBox" then
local TweeningPart = Hit
if not LastCFrame then
LastCFrame = TweeningPart.CFrame
end
local PartCFrame = TweeningPart.CFrame
local Rel = PartCFrame * LastCFrame:Inverse()
LastCFrame = TweeningPart.CFrame
RootPart.CFrame = Rel * RootPart.CFrame
else
LastCFrame = nil
end
end
RunService:BindToRenderStep("CharacterBindFunction", 200, BindCharacterToModels)