Hello! For my upcoming game I am working on how to calculate collisions to a LinearVelocity object tied to a particle.
Here is the buggy script that I decided to use as a temp solution:
local function TakeVelocityD(p)
game["Run Service"].Heartbeat:Connect(function()
local tParts = p:GetTouchingParts()
local prm : LinearVelocity|any = p.Main
local pm : LinearVelocity = prm
for i, v in pairs(tParts) do
if v.Parent == workspace.Particles then
local pom = p:FindFirstChild('Main')
local om : LinearVelocity = pom
local op = pm.VectorVelocity
om.VectorVelocity+=pm.VectorVelocity/(#tParts+1)
end
end
if #tParts > 0 then
pm.VectorVelocity/=#tParts
end
end)
end
The function would be runned in a coroutine with input of the particle.
Here are the variables I have for the LinearVelocity and Attachment of each particle:
Thanks in advance to whoever got any suggestions or a solution!