Terrain:FillBlock() refuses to work without any errors

I’m trying to achieve some Mud Physics which work similar to MudRunner. The very first issue I’m running into is that Terrain:FillBlock() refuses to work and I have no idea why.
If there was a way to detect when a part starts rotating that’d be great too since I doubt it’s because me trying to do this every frame.

rs:BindToRenderStep("MudPhysics", 1, function()
				for i,wheel in wheels do
					if wheel:FindFirstChild("WheelPart") then
						terrain:FillBall(wheel.WheelPart.CFrame, wheel.WheelPart.Size / 2, Enum.Material.Air)
					end
				end
			end)

image
As you can see in this picture the car is sitting perfectly fine on the mud, while it’s supposed to dig through it.

1 Like

Try to make the fill radius larger, terrain voxels are large so you will need a bigger influence range

Set it all the way to 100. No effect.

Could you run print() after “then” on line 3? If the print passes into the output you can at least know your code is identifying the “WheelPart”

Yup it prints.
image

The post title says you are using FillBlock, however your code is using FillBall

If you meant to use FillBall, you need to send a Vector3 as the position and a Number as the radius, otherwise you will get an error

Could this be the issue?

Oh that’s a error from me. Yeah I use FillBall instead and fixed the arguments it was expecting

terrain:FillBall(wheel.Wheel.WheelPart.CFrame.Position, wheel.Wheel.WheelPart.Size.Y * 2, Enum.Material.Air)

On the first argument it expects a Vector3, I had sent it a CFrame instead. On the second argument it was expecting a number, I had sent it a Vector3 instead too.
It still won’t run! This line is not even executing even though it’s supposed to.

Nevermind, it suddenly started working after I restarted Studio.
The issue was probably the arguments but I’ll still mark your post as the solution since you tried to help. Thank you.

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.