I am using moving constraints while wondering if there is better (maybe programmatic) ways of actioning this event.
I’m looking for a way to have the wall effectively push (with force) eligible parts (This is managed by pre-determined Collision Groups).
At the moment it works. Not well but it does. The persistent issue I’m having though is that when the wall needs to apply force upon a large number of unanchored parts, it cant. I assume this is because the built-up friction and mass of the affected parts but i’m not sure.
I was using ApplyImpulse, to hopefully help the parts on their way, but I see the wall getting visually stuck on masses of parts, but still applying an impulse to parts which have not been visually contacted.
func = function(event)
local debounce = {}
local wall = event_assets.Wall:Clone()
local finish = event_assets.WallEnd:Clone()
local y_pos = workspace.Game.Islands.CentralIsland.Island.PrimaryPart.Position.Y + math.random(-30, 30)
wall.PrimaryPart.Position = Vector3.new(wall.PrimaryPart.Position.X, y_pos, wall.PrimaryPart.Position.Z)
finish.PrimaryPart.Position = Vector3.new(finish.PrimaryPart.Position.X, y_pos, finish.PrimaryPart.Position.Z)
finish.Parent = workspace.Game.CleanUp
wall.Parent = workspace.Game.CleanUp
wall.Wall.AlignPosition.Attachment0 = wall.Wall.Attachment
wall.Wall.AlignPosition.Attachment1 = finish.WallEnd.Attachment
wall.Wall.AlignOrientation.Attachment0 = wall.Wall.Attachment
wall.Wall.AlignOrientation.Attachment1 = finish.WallEnd.Attachment
wall.Wall.AlignPosition.Enabled = true
wall.Wall.AlignOrientation.Enabled = true
wall.PrimaryPart.Touched:Connect(function(part)
if part.CollisionGroup == "GameFree" then
if not debounce[part] then
-- part:ApplyImpulse(wall.PrimaryPart.CFrame.LookVector * 2 + Vector3.new(0,4,0))
else
return
end
task.delay(.5, function()
debounce[part] = nil
end)
end
end)
Debris:AddItem(wall, 5)
Debris:AddItem(finish, 5)
end,
I really want to stick to using moving constraints as I like the ease of implementing interactions between them.
Thank you!