Get light poles to fall down without stopping the vehicle

I’m tryna allow light poles to fall down when they are hit, however it’s not consistent. Sometimes my car will come to a complete stop, before moving through the pole (pole never falls over)
ezgif.com-gif-maker - 2022-12-05T125121.905

The car should not be stopped by a light pole. Ideally once hit, the part should be drive through able and fall over. Problem with setting the collision group instantly is the pole just never falls over.

function StreetLightDestructibleComponent:Start()
	self.Trove:Connect(self.Instance.PrimaryPart.Touched, function(hit)
		if not CollectionService:HasTag(hit.Parent, "Vehicle") then
			return -- Not a vehicle, do nothing
		end

		if self.KnockedOver then
			return
		end

		self.KnockedOver = true

		Library:Weld(self.Instance, self.Instance.PrimaryPart) -- Weld all the parts

		-- Unanchor the model (so it falls over)
		for _, part in self.Instance:GetDescendants() do
			if not part:IsA("BasePart") then
				continue
			end

			part.Anchored = false
		end

		-- self.Instance.PrimaryPart:ApplyImpulse(hit.AssemblyLinearVelocity * 1000)

		-- Wait a split second before disallowing collisions with the vehicle (gives model time to fall over)
		task.delay(0.5, function()
			for _, part in self.Instance:GetDescendants() do
				if not part:IsA("BasePart") then
					continue
				end

				PhysicsService:SetPartCollisionGroup(part, "Destructible")
			end
		end)

		task.delay(Constants.DESTRUCTIBLE_RESPAWN_TIME, function()
			self.Backup.Parent = self.Instance.Parent

			self.Instance:Destroy()
		end)
	end)
end

I tried the ApplyImpulse but it had really negative effects
ezgif.com-gif-maker - 2022-12-05T121005.517

1 Like

You should try helping the process by using ApplyImpulse() on the light pole. That way there’s an almost 100% chance it will fall down, heck, even go flying if that’s what you want.

2 Likes

Are you applying it on the pole? also, you may need to up the force, or down it. One last thing, are you applying it in the right direction? I almost forgot, there are other methods of apply forces to objects, and you could try those, too.

1 Like

I already tried using ApplyImpulse

Well from my limited knowledge on Vector3’s, to me it looks like I’m applying the force in the same direction the car moves (so when you hit it, it actually looks like it’s been hit. But it’s flipping the car out

so applying more force would not work.

You can also change the pole mass to lower.

And, just in case you aren’t doing it right (I don’t want to force you to do it my way)

local force = 20
pole:ApplyImpulse(car.Orientation.Unit * force)

try this, see if it works. lower or up the force to your liking.

if that doesn’t work, try this

local force = 20
pole:ApplyImpulse(CFrame.new(car.Position, pole.Position).LookVector.Unit * force)
1 Like

Both didn’t work. I either go straight through the pole and it doesn’t fall, or I hit the pole and the car stops, before I can drive through
ezgif.com-gif-maker - 2022-12-05T135233.403

Hm… try setting CustomPhysicalProperties to true, and lowering it’s density to around 2.

1 Like

Set all the parts on the light pole to massless and then set primarypart (the invis part that detects hit) to have 2 density
ezgif.com-gif-maker - 2022-12-05T140649.761
Unsure how it’s falling through the map. They get their collision group set to Destructible, which has collisions with Default set to true. Only thing it should pass through is the vehicle parts

1 Like

It was colliding before, but it stopped for some reason. What did you change?

-- Unanchor the model (so it falls over)
		for _, part in self.Instance:GetDescendants() do
			if not part:IsA("BasePart") then
				continue
			end

			part.Anchored = false
			PhysicsService:SetPartCollisionGroup(part, "Destructible")
		end

		self.Instance.PrimaryPart:ApplyImpulse(CFrame.new(hit.Position, self.Instance.PrimaryPart.Position).LookVector.Unit * 20)

I disable collisions. I don’t want the light to make the car stop. The car should pass through as it falls

1 Like

Yes, but if you disable collisions, the light also won’t move. Enable collisions, and test the previous method.

That’s the point of the impulse. To make the light fall over without the car needing to physical push it over. When collisions are on, the car either hits the pole and gets stopped by the pole, which ruins UX or the pole falls awkwardly on the car, making the car stop anyway. User should be able to drive straight through with nothing interacting with their car to cause it to slow down/stop

1 Like

Which is what I’m saying. Decrease the parts density to decrease the effects on the car.

Disable the collision setting, result (with density 2)
ezgif.com-gif-maker - 2022-12-05T142738.065

1 Like

Ah, I have an idea. This has to do with the massless property. use a WeldConstraint on an invisible unanchored part onto it then size it to your liking, and then make the actual pole massless. The reason for this is because massless only applies for welds. You would use it to ignore the weight of some parts in a weld, and consider the weight of others. So here, make a “weld” and then ignore the weight of the pole, but consider the weight of the part. If it is too light, make the part bigger.

Also, try aligning the invis part with the pole, so that physics don’t seem off.

properties for the invisible part:
image
properties for the pole:
image

Here’s how it looks, the red part is the pole the green part is the invis part:
image
You can change the positions and stuff, too. Even put the green part inside the red part.