How would I create a building system similar to that of Plane Crazy or Build a boat for treasure

Hello! I am attempting to create a game that requires a building system. I have searched online however none of the tutorials cover the system I need. Im hoping to create one similar to the one used in Plane Crazy, or the one used in Build A Boat For Treasure

Anyone know of a tutorial I missed OR what system I would need to use to do this (like raycasting or something)

Thank you!

3 Likes

I know I’m a bit late to respond but I am currently making a game called HecticBuilds which uses a building system that I made. For my system, I use a combo of raycasting and mouse.Hit/mouse.Target (I originally used just that and have been switching to raycast because raycast is better to work with). If you want to keep it basic like F3X, I would recommend shooting a raycast away from the player’s camera towards the mouse position. Then create a part in the workspace and set the position of the part to the raycastresult position. the reason I use raycasts is that it is easier for me to filter out blocks without setting them to can-collide-false and can-query-false. here is a bit of code from my game. (this is used for the placement of the block hitbox on the client)

									local mouseposition1 = UIS:GetMouseLocation()
									local Camera = workspace.CurrentCamera
									local raycastdistance = 10000
									local raycastparameters = RaycastParams.new()

									raycastparameters.FilterType = Enum.RaycastFilterType.Blacklist
									raycastparameters.FilterDescendantsInstances = filter

									local mouseray = Camera:ViewportPointToRay(mouseposition1.X, mouseposition1.y)
									local Raycastresult = workspace:Raycast(mouseray.Origin, mouseray.Direction * raycastdistance, raycastparameters)
									local resultname = Raycastresult.Instance
									local resultsurface = Raycastresult.Normal
									local resultsurfaceX = math.round(Raycastresult.Normal.X)
									local resultsurfaceY = math.round(Raycastresult.Normal.Y)
									local resultsurfaceZ = math.round(Raycastresult.Normal.Z)
									
									X = math.floor(Raycastresult.Position.X + 1) - .5
									Y = math.floor(Raycastresult.Position.Y + 1)
									Z = math.floor(Raycastresult.Position.Z + 1) - .5
									
									if mouse.Target == Raycastresult.Instance then
										if mouse.Target == workspace.Plot1.Base then
											Y = math.floor(Raycastresult.Position.Y + 1) + 1
										else
											Y = math.floor(Raycastresult.Position.Y + 1) 
										end
									end

									positionA = CFrame.new(X, Y, Z)

									if resultsurfaceY == 1 then
										positionA += Vector3.new(0,0,0)
									elseif resultsurfaceY == -1 then
										positionA += Vector3.new(0,-2,0)
									elseif resultsurfaceX == 1 then
										positionA += Vector3.new(1,0,0)
									elseif resultsurfaceX == -1 then
										positionA += Vector3.new(-1,0,0)
									elseif resultsurfaceZ == 1 then
										positionA += Vector3.new(0,0,1)
									elseif resultsurfaceZ == -1 then
										positionA += Vector3.new(0,0,-1)
									end

									block:MoveTo(positionA.p)

I hope this helps in the case you are still working on this.

I completely abandoned the project and have worked on 2 other games since then, but I hope that your reply can be of use to other people! Thanks

1 Like

ok, thanks.
just in case you ever decide to restart the project it’ll be here.
also, if anyone else wants to use it as well, ye feel free.

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