3D Conveyor Belts in Unity Tutorial

  Рет қаралды 14,217

Jayometric

Jayometric

Күн бұрын

2023 Update! New 3D conveyor belt video out. • 3D Conveyor Belts Tuto...
A quick tutorial on how to make any object into a conveyor belt in Unity. I may follow this up with how to change the direction while on the object, but this is for single direction conveyor belts.
Code here: github.com/Jay...
Click to Subscribe ► / @jayometric
Jayometric on Social Media:
Like me on Facebook ► / jayometricgames
Follow me on Twitter ► / jayometric
Follow my Instagram ► / jayometricgames
Check out my models on Sketchfab ► sketchfab.com/...
Check out my Itch page ► jayometric.itc...
Check out my School work Itch page ► jasonpete.itch...
Check out my GameJolt page ► gamejolt.com/@...

Пікірлер: 25
@HackFight
@HackFight 3 жыл бұрын
If you don't want your objects to roll on the belt do this: 1) Create a physic material with Dinamic and Static friction to 0. 2) Put it on your objects. I hope it helps :)
@jzzsxm
@jzzsxm 2 жыл бұрын
Thank you for immediately answering the question I was about to ask!
@diagglabo1038
@diagglabo1038 2 жыл бұрын
You can also freeze the rotation on the Rigidbody (if your physics object doesn't require rotation).
@pollywop6339
@pollywop6339 3 жыл бұрын
This code works fine however, anything that lands on the conveyor belt is effected by momentum after they leave the belt. Is there a way for the object that leaves the belt (specifically a player) to stop moving immediately ?
@jayometric
@jayometric 3 жыл бұрын
If you want it to stop moving right after it leaves the belt, you can add a line to the OnCollisionExit function. For example collision.gameObject.GetComponent().velocity = Vector3.zero; That will make the x, y and z velocity all zero as it leaves the collision.
@polarsvisuals4132
@polarsvisuals4132 3 жыл бұрын
Followed this in a blank Unity scene but to cube moves extremely slower, even copied to code. Any help?
@jayometric
@jayometric 3 жыл бұрын
It seems the math works differently in newer versions of Unity. You can turn the speed up higher, or remove the * Time.deltaTime from the velocity. Taking out Time.deltaTime is fine here because we are setting it to a constant velocity. Git Line 22 should now be: onBelt[i].GetComponent().velocity = speed * direction; I updated the github as well. Hope that helps!
@Chiips55
@Chiips55 2 жыл бұрын
Thank you for this amazingly simple code, and the explanations! Got it to work in all direction in just a few minutes!
@cheesecakenl1980
@cheesecakenl1980 3 жыл бұрын
Hey @Jayometric Nice clean content on physics based conveyor belt. Any experience in scaling this up to thousands of belts and items on the belts ? Also how would you implement a corner/curved belt ?
@jayometric
@jayometric 3 жыл бұрын
Depending on the objects shape you could add triggers for the objects to pass through and use that to change their direction by giving them a new velocity. It would be straight directions but enough of them would make an okay curve. I haven't tried putting more than maybe 50 on belts at a time. Thousands would be a lot of physics to calculate but it's always worth giving it a test!
@NoviceTinkerer
@NoviceTinkerer 3 жыл бұрын
I got the concept that I'm needing thanks to you
@nat22157
@nat22157 3 жыл бұрын
This is so simple compared to other videos thank you!
@lightness7670
@lightness7670 Жыл бұрын
1- Use a Queue 2- Get the component on collision never in Update
@lunchbox1553
@lunchbox1553 Жыл бұрын
Queues are only for lists where you know you're going to be add/removing items in the order they're added. If you make this more complex, or you add a way for items to be removed in the middle of a conveyor, then a queue is not the way to go.
@lightness7670
@lightness7670 Жыл бұрын
@@lunchbox1553 You can use a hashset for that purpose but conveyer is first in first out usually
@lunchbox1553
@lunchbox1553 Жыл бұрын
@@lightness7670 Thanks for the recommendation, it has been slightly confusing knowing which to use coming from a language where there are only primitives and unordered lists.
@CTNG-Originals
@CTNG-Originals 3 жыл бұрын
1.131 views and only 12 subs.... that's unfair to me so ill be a Subscriber++
@Cardinal_
@Cardinal_ 4 ай бұрын
how do i get it to work for characters?
@jayometric
@jayometric 4 ай бұрын
I haven't worked with characters much, but the idea would be to make it so when they are touching the conveyor to add the speed of the conveyor to the character movement. Maybe something like having the velocity += converySpeed along with whatever logic for input to move the player. Maybe in OnCollisionEnter have a boolean to let the character know when they start touching. Then, set the boolean false OnCollissionExit. That's my initial thoughts on it, at least. I hope that helps.
@SunlinesAmbient
@SunlinesAmbient 4 жыл бұрын
can you put the script?pls
@jayometric
@jayometric 4 жыл бұрын
Code has been posted! I added it to the description.
@张馥樟
@张馥樟 4 жыл бұрын
Thanks a lot!Sir!
@RootTheCoop87
@RootTheCoop87 2 жыл бұрын
It works for objects, but I can't get it to work for characters.
@D-TroS
@D-TroS 2 жыл бұрын
Does this work for 2D games?
@jayometric
@jayometric 2 жыл бұрын
For 2D games theres a built in Surface Effector 2D. On the collider check the box for "Used By Effector" and make sure to add the effector to that same object. Then set the speed of the effector.
Adding Conveyor Belts to My New Game! | Devlog
5:51
Coding With Russ
Рет қаралды 7 М.
Raycasts in Unity (made easy)
16:30
Game Dev Beginner
Рет қаралды 94 М.
ДЕНЬ УЧИТЕЛЯ В ШКОЛЕ
01:00
SIDELNIKOVVV
Рет қаралды 2,9 МЛН
The selfish The Joker was taught a lesson by Officer Rabbit. #funny #supersiblings
00:12
Life hack 😂 Watermelon magic box! #shorts by Leisi Crazy
00:17
Leisi Crazy
Рет қаралды 21 МЛН
Trivia Question System in Unity Tutorial
29:28
Jayometric
Рет қаралды 9 М.
Building Satisfactory-like conveyor belts
7:52
vvcaw
Рет қаралды 6 М.
Remake - Belt / Conveyor System Tutorial [Unity3D]
17:58
CodingWithRus
Рет қаралды 10 М.
Blender 2.8 Dynamic Conveyor Belt 10 Min Tutorial EASY
12:46
MajesticSkies
Рет қаралды 48 М.
How to Add a Field of View for Your Enemies [Unity Tutorial]
23:45
Comp-3 Interactive
Рет қаралды 88 М.
Unity Game Dev - Conveyor Belts!
3:10
BWDev
Рет қаралды 41 М.
Manufacturing Discrete Event Simulation using UNITY - Part 01
21:45
I Made a Factory Game in 20 HOURS!
18:16
Code Monkey
Рет қаралды 128 М.