Curved conveyors

I’m trying to adjust the conveyors in my tycoon and make the turns a lot smoother so the parts don’t crash against the wall. Basically I have a corner piece but the way I’ve always done this is by making the assembly velocity of that piece very fast in the direction I wanted to turn it in but that never worked out the way I wanted it to.

I thought AssemblyLinearVelocity looked like a perfect way to turn parts around a center however this method can only seem to get parts to circle around the center of the conveyor at least from what I know. I just want a quarter circle rotation centered around a point in the inner corner of the conveyor.

You could have some parts on your conveyor that don’t move parts, this should slow down the parts before hitting a turn.

I could try that but there’s when there’s a part of the conveyor that doesn’t move there’s a higher likelihood parts would get stuck there.

i normally have a script like this to perfectly set the AssemblyLinearVelocity to the direction the part is rotated
this way you can smoothly rotate conveners and it will always push along its lookvector

local speed = 5
local conveyor = ...
conveyor.AssemblyLinearVelocity = conveyor.CFrame.LookVector * speed

and you could do something like this for corners by rotating the AssemblyLinearVelocity by 45 degrees

local speed = 5
local conveyor = ...
local direction = (conveyor.CFrame.LookVector + conveyor.CFrame.RightVector).unit
conveyor.AssemblyLinearVelocity = direction * speed
2 Likes

Adding on to this, if you don’t want to specify the conveyor, you could cast a ray below the piece and get the conveyor that way, but this could be performance heavy depending on the amount of parts you plan to use this for.

I would most likely use tags to find all conveyors

This might seem somewhat unnecessary, but it is possible to have curved conveyors by applying rotational velocity to a union (unioned so that its rotational axis is displaced and makes it suitable).

1 Like

I gave this a shot and tested it in studio. It works some of the time but has some erratic behavior. (The parts would sometimes fly in random directions for seemingly no reason)

What about this?

Imagine this being a left angled conveyor. This will push the part to be at least in the middle of the new lane.

I was able to find out the problem was with how I built it not the concept itself. This actually worked. However, I had to move the complementary part out of the players’ view. and then balance it’s center of mass towards the center. Too far above or below will not work. So put two pieces 500 or 1000 studs on top or on bottom far enough to be out of players view then add a second piece on top to balance it.

1 Like

This can be done without the union by using both Velocity and RotVelocity.

If you put a hinge at the corner of a part and spin it around, the part will gain both Velocity (to orbit the hinge) and RotVelocity (to adjust its rotation such that its corner is always on the hinge).

Let a straight conveyor be 6 studs wide and 20 velocity.
A corner piece might be 6x6.
The distance from the edge to the center of a straight conveyor is 3, but the distance from the corner to the center of the corner conveyor is 3 * sqrt(2).
Velocity and RotVelocity apply to the center of the bounding box (just the center, as it’s just a square brick here)
So the center would have a Velocity of something like (20, 0, 20), which is (20, 0, 0) rotated 45 degrees and multiplied by sqrt(2) to adjust for the diagonal.
RotVelocity is in radians per second.
One radian of rotation is also one radius of movement.
So 20 studs per second divided by (3 * sqrt(2)) makes about 4.7 radians per second. RotVelocity should therefore be (0, 4.714045207910316, 0) (possibly with the sign flipped if I didn’t get lucky)

image
please excuse the white background

2 Likes