I am attempting to create a conveyor similar to the one in this video:
(streamable as its over 10mb)
I say attempted but I haven’t tried yet, I’m asking for help as I’m not sure how I’m gonna go about it.
These conveyors ensure the part stays in the middle of the conveyor, they don’t just simply use “Velocity” to move objects on top of the part.
The reason i don’t want to go the velocity route is because similar to this game i want to be able to have “filter” blocks where it will redirect the part depending on certain arguments.
Any help is appreciated, I’m not asking to be spoon fed scripts just rather how will i go about making something similar.
one conveyor is its own waypoint, in the middle is the waypoint
Use raycasts to detect the next conveyor, update the raycast everytime a new build is added perhaps.
use a slot system to detect if theres already a block inside that conveyor or not, prevent jams and unloading into the air
Sure, that could work. Or, you could use a grid and depending on the direction the conveyor is facing it looks at the grid to find the next waypoint.
E.g.
-- 0 is nothing, 1 is conveyor. Obviously, you wouldn't do that but this is an example.
local grid = {
{0, 1, 0},
{0, 1, 0},
{0, 1, 0},
}
then, let’s say we’re in the middle and we want to go up. The middle is grid[2][2], where grid[y][x]. So, to look up we’d say grid[y - 1][x] which is grid[1][2].
of course, add checks to make sure you don’t go out of the bounds of your array.
also lol i hate 1-based indexing, i’m so used to 0-based where the middle would be grid[1][1]
Nice! Raycasting might work for now, but more complicated systems could benefit from a grid stored in a table, be it 2D or 3D. See my previous message if you didn’t already
ended up using a tick system, and lerping from a start position to end.
Each “Class” has a :tick() which is called by one main script, so every part/conveyor updates at the same time.
Went this route as it ensure smoothness for the conveyors and other functionalities.
I’m glad you found a solution, when I had worked on my conveyor system I ended up reworking it at least 10 different times cause I had to restructure and update different parts of the code due to different issues I found during the development of it. Unfortunately there isn’t many tutorials on conveyors with roblox aside from Physics based so I ended up reviewing Unity tutorials to try and figure out a structure.
Class based conveyors are definitely easier to manage and iterate new features into them.
Even with my Conveyor system I also had implemented raycasting to find the next conveyor cause predefining them started to have some issues.
Here soon I’m redeveloping my conveyor system again and one of the larger changes I’m going to make is handling all the back-end logic on the server and do all the item rendering on client for updating between the different conveyors.