How would I go about making a power washing system?

Hey! I’m wondering how I would be able to make a power washing system like the one linked below. I’m simply trying to make a washer to clean houses and other things. Not like earn coins and all that. I can make that on my own.

1 Like

Not sure how, but this game did it. From what I could see, it uses Raycasting and modifying a part’s color if the water part has been touched or something.

I think I figured it out.

Demo

It’s actually just a matrix of little small blocks with a decal or image label in front of them and having a spray tool(which was pretty much a block in my case) with a touched event that destroys either the image or the image blocks itself to get rid of the “dirty” effect.

The hard part is actually splitting that one decal or image onto the hundreds of tiny blocks. I managed to do that using imagerectoffset and imagerectsize.

local part = script.Parent --Part which im placing the blocks on
local width = part.Size.Z
local length = part.Size.X

--Need to use the original image resolution of the uploaded image
local imageResX = 210 
local imageResZ = 210

--Dimensions of the small cube(I used a cube so I only needed X)
local dirtLength = script.Parent.DirtPart.Size.X 

local lengthratio = (dirtLength / length ) * imageResX
local widthratio = (dirtLength / length ) * imageResZ

local function populateSurface()
	for i = 1, math.floor(length/dirtLength) do
		task.wait()
		for j = 1, math.floor(width/dirtLength) do
			task.wait()
			local clone = dirtpart:Clone()
			clone.Parent = script.Parent.DirtParts
			--Position the blocks into wall and stuff...
			
			clone.SurfaceGui.ImageLabel.ImageRectSize = Vector2.new(widthratio,lengthratio)
			clone.SurfaceGui.ImageLabel.ImageRectOffset = Vector2.new(widthratio * (j-1), lengthratio * (i-1) )
    	end
    end
end

After that we make a spray block with a touched event that destroys the small cubes that we just made. Couple that with some raycasting or using mouse.Hit to position the spray block and a beam for cool effects, and you’re pretty much good to go!

Bonus Stuff
The creator of the power wash simulator game seemed to made it so that the spray block would also align itself with the normals of the surface which you are cleaning, so maybe do that too.

Honestly, I don’t even know if that guy used the same concept as I did. I initially tried doing this with surfaceguis purely without physical parts and then tried using some projection magic to maybe find out which guis to remove, I ended up just giving up lol, so try that too?

Disadvantages of Using This
You’re pretty much creating a bunch of blocks every time you do this. The little demo you saw used 840 blocks, and that’s only one wall. Plus if you decrease the size of the dirt cubes, which increases the resolution, it’s only gonna get worse. One solution tho is to maybe union the parts together when they are not in use.

This doesn’t seem very efficient to me, so hopefully someone can do better than me :v:

8 Likes

Any idea if the part was not a square or regtangle ?

1 Like