For anyone struggling to get this working, the key is to set the conveyor belt's rigidbody to IsKinematic (to be fair this is shown in the video, but it's not mentioned as an explicit step by the author and his fucking conveyor belt's name is also cube so...) For clarity tho: - Boxes that go on the conveyor need a rigidbody and a box collider, defaults settings work with no issue (so Rigidbody Mass: 1, Drag: 0, Ang Drag: 0.05, UseGravity: yes, IsKinematic: no) - Conveyor Belt object needs a rigidbody and a box collider. Rigidbody settings: Mass: 1, Drag: 0, Ang Drag:0.05, UseGravity: yes. IsKinematic: YES Box collider default settings work fine. Make sure the collider extends the length of your conveyor (e.g. if modelling it yourself). Also Note, if you have Physics materials on either object's colliders, make sure the friction values are greater than 0, and friction combine not set to minimum.
OK, this earned a follow. I already knew the difference between setting the transform and using the MovePosition() method, but I never considered combining them to make something that imparts a physics force without moving.
I was super confused because I thought this was a joke video making fun of political correctness and came to the comments to see what the joke was and saw your comment. I had to check the title again to see this wasn't about politics 😂
TWO DAYS!!!! TWO FULL DAYS I SPENT ON THIS!! Dynamically adding anything that touches a belt to a list. Then applying frictionless materials to them. Then making sure the next belt doesn't remove it from a list. Made the list an SO so it could store the data between all the belts. Then making sure whenever something leaves the belt it grabs its original physic material from the dictionary . What a trainwreck!! I am SOOO GLAD I stumbled upon your video. Such an elegant and lightweight solution!!! LIFESAVER!!
The real direction of the conveyor is the "Vector3.back" in the second line. So, if you want to use other directions, you cannot only modify the transform of the conveyor. (for example, you want to rotate the conveyor) you need to modify the "Vector3.back" to your conveyor's direction. I try to set two empty GameObject "front" and "back", minus them to get a Vector3 as the conveyor's real direction and it works. Vector3 move_position = (front.position - back.position).normalized; Vector3 pos = rigidbody.position; rigidbody.position += move_position * speed * Time.fixedDeltaTime; rigidbody.MovePosition(pos);
I did nearly this exact thing on a final project years ago, was happy to find that it was a rather simple task, helped give life to the background and add some mechanical depth to the movement of our protag
It is really helpful that you explained the steps at the start. Too frequently people upload a finished code and I have no idea why what they wrote works for the implementation.
That's really cool but if you want to make it even more accurate you could add some code to accommodate for the conveyor's drag on the box. Small light boxes, for example, won't have as much grip on the conveyor so when it touches the bed the conveyor belt will slide under it for a second while the box starts to accelerate. Large heavy boxes on the other hand will accelerate much more quickly. This leads to a bit of sliding around whenever the box goes from rest to moving or when changing direction. This is actually something I have to deal with sometimes in my line of work and is a major factor when designing conveyor systems.
What a brilliant way to explain the trick without talking or having to do draw kind of confusing workflow to show. Nice! Great tutorial, though youtube randomly recommended me this for no reason lol.
i dont understand why these channels with no profile pic and no attention has legit the best graphics and layout for vids and / or best project they are showing. just random talent on youtube
Remember when SOURCE Engine introduced this first it looked like magic back then you know the VALVE Era..... Half Life 2, TF2, L4D etc Come on u know who is valve !!!!
transform.Translate(Vector2.right * horizontalAxis * speed * time.deltaTime) would be great too for movement. Or the new input System that I don't like. (It would be working with a Vector2.Zero variable that you can assign with a variable like vectomov.x or make the x a public string to assign it how you want) I like this. This is great what you were doing here.
sure, but you cant just endlessly move it across the world. youd need to move it back to its start point. which would then just drag the item right back. this code is elegantly mimicking what a looping conveyor belt would do
Really clever, but I’d like to see the performance for a lot of conveyor belts. Also, it wouldn’t impart a reverse direction for the underside of the conveyor belt, i think that’d be a cool problem to solve.
Regarding the underside, the idea is to add a separate conveyor script to each to the four parts in the diagram at 1:56, including the circular rotating ones. Though instead of using rigidbody.position and rigidbody.MovePosition on the circular parts, you would use rigidbody.rotation and rigidbody.MoveRotation.
It's all fun and games until the underside moves in the wrong direction. And the sides shouldn't drag too, technically. Oh and front and back. Man, I must be fun at parties.
You could also set rigidbody.rotation then MoveRotation if you want objects to fall on a collection of spheres that move them along. If you set rigidbody to non-kinetic and set constraints to freeze rotation but not position, it can act like a ball motor for moving a capsule ( that has constraints for rotation ) as a connected anchor using a configurable joint resulting in a rigidbody character motor - AddTorque in VelocityChangeMode is required NOT MoveRotation!