Hi, I’m trying to make a some what realistic tank track system, however, there is a massive delay, I want the link to stay static (Position not rotation).
I have tried to find some people that had similar problems, but most are using more complex scripts and joints I didn’t know existed or are using a completely different physics based system.
This script does work, but like I said earlier, there is a massive delay, I have tried while true do loops but nothing has happened.
local TrackLink = script.Parent
local Attachment1 = script.Parent.Parent.L1.Track
local Attachment2 = script.Parent.Parent.L2.Track
local RunService = game:GetService(“RunService”)
RunService.Heartbeat:Connect(function()
local pos1 = Attachment1.WorldPosition
local pos2 = Attachment2.WorldPosition
local midPoint = (pos1 + pos2) / 2
local distance = (pos2 - pos1).Magnitude
local cf = CFrame.new(midPoint, pos2)
cf = cf * CFrame.new(0, 0, -distance / 2)
TrackLink.CFrame = cf
TrackLink.Size = Vector3.new(0.9, 0.1, distance)
print(distance)
end)
BTW that isn’t the position the link is meant to be in, i just did that for testing And Track link disappears randomly