I recently came across a post by @Imaginze which showcased an amazing building system with a unique wall system that I haven’t seen in many games on Roblox.
Currently I have a simple placement system that allows the user to place models but all it does it calculate the position based on the mouse and move the model to that position until it’s ready to be placed there forever.
Can someone point my in the right direction as to how I can achieve this wall system?
What you will have to do is find the position of the mouse when they click, instance in a part, and then find the position of the mouse with RunService.RenderStepped, or you can use Mouse.Move. Then, everytime the mouse moves, it will update the part’s position, and when the mouse button is down again, you clone the part to the workspace and disconnect all the functions with :Disconnect()
Do I really have to point this out… OP is not asking for code, just some advice.
For OP, I believe The Conquerors has implemented this wall system (it’s been several years from now). You would need to update a part’s size and position, but that’s tricky because it seems like the wall has two anchored points and can only move in two dimensions.
Since you have a height Y that is constant, you can use some basic trig to calculate what the position should be in the XZ plane. The position depends on the mouse’s position on the part you are placing the wall post on top of. When you find what that position is, you can calculate the distance between the wall posts and the length of the wall, and can then set the orientation knowing tan(R) = Z/X, which is the rotation you apply in the XZ plane. You might need to play around with the angle in order to rotate about the pivot wall post, and to make sure it doesn’t rotate the opposite direction. The Y orientation is constant.
If you don’t understand, I suggest reading up on some trigonometry. If you know trig and still don’t understand, I would also suggest to read up on CFrames and orientation in general, as this is the tricky part of the coding process.
I managed to achieve a system like the one you show here. Basically break it down into what’s going on.
Beginning of placement starts with 1 pole. Have that pole move with the players mouse (snap to grid as well if you want that)
Once they click, place that original pole down, create a new pole and have the new people follow the mouse. Then while that’s happening, create a wall to fill between the original pole and the new poles positions.
Without diverging too much of my code, here’s just a chunk for how I generated the wall between the two poles: