Getting Started with Unity DOTS Physics

  Рет қаралды 90,319

Code Monkey

Code Monkey

Күн бұрын

✅ Let's check out how to use Unity DOTS Physics!
Super Performant Collisions, Events, Triggers and Raycasts!
Get the Project files and Utilities at unitycodemonkey.com/video.php...
Getting Started with Unity DOTS / ECS
• Unity DOTS / ECS Tutor...
Unity DOTS Physics Samples
github.com/Unity-Technologies...
Unity DOTS Physics Manual
docs.unity3d.com/Packages/com...
Layers, LayerMasks, Bitmasks, Bitwise Operators, Raycast
• Unity Layers, Layer Ma...
If you have any questions post them in the comments and I'll do my best to answer them.
🔔 Subscribe for more Unity Tutorials / @codemonkeyunity
See you next time!
📍 Support on Patreon / unitycodemonkey
🤖 Join the Community Discord / discord
📦 Grab the Game Bundle at unitycodemonkey.com/gameBundl...
📝 Get the Code Monkey Utilities at unitycodemonkey.com/utils.php
#unitytutorial #unity3d #unity2d
--------------------------------------------------------------------
Hello and welcome, I am your Code Monkey and here you will learn everything about Game Development in Unity 2D using C#.
I've been developing games for several years with 7 published games on Steam and now I'm sharing my knowledge to help you on your own game development journey.
You can see my games at www.endlessloopstudios.com
--------------------------------------------------------------------
- Website: unitycodemonkey.com/
- Twitter: / unitycodemonkey
- Facebook: / unitycodemonkey

Пікірлер: 160
@CodeMonkeyUnity
@CodeMonkeyUnity 4 жыл бұрын
Let's look at Unity DOTS Physics! Easy to use with the promise of thousands of physics objects! What Physics demos would you like to see? 🎮 Play 7 Awesome Games (Action, Strategy, Management) and Help Support the Channel! ✅ Get the Game Bundle 67% off unitycodemonkey.com/gameBundle.php
@guilllexx
@guilllexx 4 жыл бұрын
this video is so cool :) can you make a video on gravity? ... gravity on a planet, gravity system with player moving inside a traveling ship, gravaity toward one or multiple objects, fading gravity over distance ...
@dert.3747
@dert.3747 3 жыл бұрын
There is a litte error in your update-function where you call Raycast with the direction vector, not the end-point. You call "Raycast(ray.origin, ray.direction * rayDistance)" instead of "Raycast(ray.origin, ray.origin + ray.direction * rayDirection)". Otherwise very helpful as always!
@skippythemagnificent8103
@skippythemagnificent8103 2 жыл бұрын
I'm getting errors on .entities in the Trigger events, is this depreciated or somthing i am doing, I appreciate this was done some time ago, could do with a heads up :)
@gabrielalabi4385
@gabrielalabi4385 2 ай бұрын
really helpful video. Does Physics Shape support 2d
@CodeMonkeyUnity
@CodeMonkeyUnity 4 жыл бұрын
Sorry about my voice being a bit off, been a little sick lately, hope you like the video!
@KimboKG14
@KimboKG14 3 жыл бұрын
Took me 4 days of my vacation, but I finally built a multithreaded raycast system in 3D space. Except for you & that other DOTS-guy on yt there is just no resources except for the api. We really need to share and spread the knowledge if we want more indie devs to use DOTS! I miss those official unity tutorials.... Hope you keep up the good work.
@siddharthgupta9403
@siddharthgupta9403 4 жыл бұрын
Amazing video! You have one of the best videos currently available on Unity DOTS. Keep going!!
@KimboKG14
@KimboKG14 3 жыл бұрын
your tutorials are absolutely amazing! On the spot, awesome audio, and very well researched! Plus unity is finally starting to get stable again. I made one "pure ecs" game long time ago and looking to make a new one now that we have the neccesary systems in DOTS.
@factopiavideos
@factopiavideos 4 жыл бұрын
yassss!! keep making videos about complex topics like these. Thank you
@piyushmayekar1192
@piyushmayekar1192 3 жыл бұрын
This channel is so good! Top tier explanation: precise & concise. Thanks a ton!!
@andywatts
@andywatts 4 жыл бұрын
Very cool. Covered a lot in 20 minutes. Thank you.
@vildauget
@vildauget 4 жыл бұрын
Very nice video to get our feet wet in DOTS Physics - thank you. Hope you feel better.
@sanderliivandi8498
@sanderliivandi8498 4 жыл бұрын
Hello! I would like to point out that when following along with a fresh project, it is also necessary to install the Hybrid Renderer package as otherwise the entities do not get rendered. This has been mentioned in your ECS tutorial, but I managed to forget that and for some time could not figure out, why the cube and sphere kept disappearing :D
@xaxababa6616
@xaxababa6616 4 жыл бұрын
Holy ****! I was thinking about this just now!! Thanks CM!
@andrewshandle
@andrewshandle 4 жыл бұрын
I'm really enjoying your content, this is great video. Thanks!
@marcaurelio74
@marcaurelio74 4 жыл бұрын
Really useful tutorial! Thanks for your effort!
@azaroth75
@azaroth75 4 жыл бұрын
This is a gold nugget, ty!
@geri4367
@geri4367 4 жыл бұрын
Awesome! I'd love to see some sort of mini game done fully with DOTS physics. Something like a basic spaceship shoot em up. Also curious if there is some kind of animation system setup for DOTS or not
@CodeMonkeyUnity
@CodeMonkeyUnity 4 жыл бұрын
Yup I was thinking of trying to make Space Invaders, sounds like it could work as a simple game and then play around with thousands of enemy ships. I believe there's a Animation system currently in the experimental stage.
@warlockCommitteeMeeting
@warlockCommitteeMeeting 4 жыл бұрын
Thank you for sharing this valuable information
@JamesBowling
@JamesBowling 4 жыл бұрын
Thanks for the awesome tutorials. I've found them incredibly helpful for getting my head around the all this DOTS stuff. Small thing with your raycast, I'm fairly sure that should be Raycast(origin, origin + direction * distance), not Raycast(origin, direction * distance)
@jamesmillerjo
@jamesmillerjo 4 жыл бұрын
Yay! I wanted this!
@electromorphous9567
@electromorphous9567 4 жыл бұрын
Such cool. Much helpful.
@zhongyechen7639
@zhongyechen7639 3 жыл бұрын
thanks for your video, it is very very very helpful
@mehmedcavas3069
@mehmedcavas3069 4 жыл бұрын
Yess finally 😍
@MrGreenlund
@MrGreenlund 3 жыл бұрын
With the raycast you do at around 12:00, is it possible to access the Physics Shape that the ray hit? I've previously in normal unity physics used it to make my 3rd person camera ignore objects that are very thin etc.
@starburstdragon
@starburstdragon 4 жыл бұрын
Great vid - thx :) - there is extremely small number of vids/examples etc that cover unity.physics imo
@vrtech473
@vrtech473 4 жыл бұрын
A tutorial of 2D Physics with 10,000 units bouncing around would be a great learn and fun :)
@4DGlasses
@4DGlasses 4 жыл бұрын
Yes please
@MNenad
@MNenad 4 жыл бұрын
Great tutorial again, but I have a question: I used the bitmask (1u
@MikevomMars
@MikevomMars 4 жыл бұрын
Are there any drawbacks on using both, "normal" and DOTS stuff together in a project? Are there any benefits from partially using DOTS in a project?
@CodeMonkeyUnity
@CodeMonkeyUnity 4 жыл бұрын
You can and you should mix them together where it makes sense. That's exactly what I'm covering in the video going live later today, it uses normal game objects for my animated units but then uses super fast DOTS Pathfinding to calculate the path. So you can definitely build your games the normal way using game objects and then just convert the performance intensive parts into DOTS
@stesproject
@stesproject 3 жыл бұрын
Hi! Great tutorial!
@yayaskurt
@yayaskurt 2 жыл бұрын
Hi, thanks for this tutorial. I wonder why if restitution is 1 it looses velocity on each impact?
4 жыл бұрын
What I would like to see is unity dots physics and netcode integration. Just started playing around with it a bit myself :)
@KimboKG14
@KimboKG14 3 жыл бұрын
Actually the raycast job is automatically scheduled in parralel. The trick is to built->cast->execute in a multithreaded chain! But thanks to your tutorials and 2 days of my vacation I finally have 1k entities casting for the player. Point is thought, results are returned as unityEngine.Raycasthit so you need to manually convert your desired information into bittable values for further implementation in jobs. Posting my basic script on my channel soon. Thank you so much for making so good tutorials. It's just such a shame that unity hasn't made ecs tutorials like they used to with mono. Especially when it comes to such basic things as raycasting.
@fruei_
@fruei_ 4 жыл бұрын
Hello , awesome video !! . I need help, i'm trying to implement ICollisionEventJob :C, need to play a hit sound when a ball touch a wall or any other object, i need to know if a collision has ocurred, sorry about my english im from argentina
@russellthorburn9297
@russellthorburn9297 3 жыл бұрын
I'd love to see you implement the preview version of the Havok Physics Engine.
@sabrango
@sabrango 4 жыл бұрын
Thx! Why I didn't watch this so far?
@alphabetadministrator
@alphabetadministrator 7 ай бұрын
Hey Code Monkey, for this specific tutorial, did you use the built in render pipeline or SRP? This is crucial to me since I cannot upgrade URP or HDRP from the built in render pipeline and need to make ECS collisions work on the built in render pipeline. Thanks in advance!
@CodeMonkeyUnity
@CodeMonkeyUnity 7 ай бұрын
Physics shouldn't have anything to do with rendering. This video is pretty old, here I believe I was using the Hybrid Renderer which I believe is related to URP
@Unforgiven215
@Unforgiven215 4 жыл бұрын
I'm having a hard time wrapping my head around how ITriggerEvents work. Is the job you created scheduled only when there is a collision with a trigger, or is it scheduled every frame? Is there documentation anywhere where ITriggerEvents are explained?
@CodeMonkeyUnity
@CodeMonkeyUnity 4 жыл бұрын
Check the official Unity DOTS Physics samples, there's several demos there that use Triggers
@johncardussi
@johncardussi 3 жыл бұрын
I only need 2D raycasts to detect clear driving paths for cars. Is there a lot of speed to be gained by switching to DOTS physics?
@AbyssalManta
@AbyssalManta 3 жыл бұрын
Might be a stupid question, but how do you actually use the samples? The instructions tell you to create a new project, import the Hybrid Renderer and stop there. Where do the files you download from the GitHub enter the picture?
@taylors1545
@taylors1545 4 жыл бұрын
How would you efficiently handle different collision pairs? For example: The player and enemies shoot a different projectile type. Each projectile plays a different sound and particle system on impact. Each projectile has their unique sounds / particles for hitting different 'pairs' such as the player, an enemy, the floor, the walls, etc. Would you write a single system, then depending on the pairs invoke the proper logic using a function pointer?
@CodeMonkeyUnity
@CodeMonkeyUnity 4 жыл бұрын
Identify objects with Tag components and do the logic based on the Tags. I haven't tested so not sure if it would be better to have a single Job handling all possible interactions or multiple Jobs each handling a specific type of interaction. I'm guessing more Jobs will have some overhead but it's likely worth it to keep your codebase nice and clean.
@NinjaSlv
@NinjaSlv 2 жыл бұрын
are you using any additional packages for Dot physics?
@kil98q
@kil98q 3 жыл бұрын
looks like an insane amount of code to let that ball jump :(
@quoctuanlee3544
@quoctuanlee3544 3 жыл бұрын
It's a pain in the ass but if we want to squeeze out any ounce of performance from it, we have to :(
@kil98q
@kil98q 3 жыл бұрын
@@quoctuanlee3544 But the idea of getting a huge robot swarm to work sounds pretty worth it ...
@Unforgiven215
@Unforgiven215 4 жыл бұрын
Is there a significant performance gain from using this physics system over the old one? Could you for example have something like 10k rigidbodies with good performance?
@CodeMonkeyUnity
@CodeMonkeyUnity 4 жыл бұрын
I haven't tested the limits yet but yes it should work for thousands of rigidbodies. With normal game objects things start to slow down when you have something like 5k game objects whereas in ECS you can have 100k+
@hamzamgaad7131
@hamzamgaad7131 4 жыл бұрын
where do u learn all this ? there is just a few resources on the web !!
@CodeMonkeyUnity
@CodeMonkeyUnity 4 жыл бұрын
I read the Documentation, Manual, analyze the official samples and do lots of trial and error. These complex DOTS videos take a long time during research before I can make the video.
@donkeymonkey4435
@donkeymonkey4435 3 жыл бұрын
@@CodeMonkeyUnity U are Absolutely Great!
@quzant9745
@quzant9745 3 жыл бұрын
Good day! The keys W, A, S, D do not work for me when driving, what could be the problem?
@user-ku2yl1rd8b
@user-ku2yl1rd8b 3 жыл бұрын
Awesome
@josueccama303
@josueccama303 4 жыл бұрын
Thanks for your videos, I have a question. In case you want to control collisions and physical 2D, how would you do it?
@CodeMonkeyUnity
@CodeMonkeyUnity 4 жыл бұрын
Right now DOTS works solely in 3D so there's no dedicated 2D Physics but you can easily just make sure the Z never changes.
@josueccama303
@josueccama303 4 жыл бұрын
thanks, for the answer, I wait for the next chapter of codemonkey :).
@ramjir6788
@ramjir6788 6 ай бұрын
I have a doubt, entities can only interact with entity? Can a regular rigidbody interact with entity having rigidbody ?
@turntupgamer878
@turntupgamer878 4 жыл бұрын
thank you
@quoctuanlee3544
@quoctuanlee3544 3 жыл бұрын
When I put stepPhysicsWorld.Simulation at 17:43 , Unity logs out an error that says: cannot convert from Unity.Physics.ISimulation to Unity.Entities.EntityQuery. So what can I do now?
@jamesmillerjo
@jamesmillerjo 4 жыл бұрын
You implemented 'directly adding dots physics' example by adding conversion script to game object (in editor), then can I make that process fully code-driven by creating object-adding components-adding conversion script? If not, is there a way to *make dots phsics object by pure-ECS approach* ?
@CodeMonkeyUnity
@CodeMonkeyUnity 4 жыл бұрын
Sure you can make everything straight through code, create an Entity and manually add the Physics components you want like PhysicsVelocity.
@siemasiemasiem
@siemasiemasiem 4 жыл бұрын
Great video. Please, cover the joints topic in next vid. BTW. What you mean by Havok is not free? Unity don't adds Havok to the free version or what? I have to pay havok's people to make a game with havok in Unity?
@CodeMonkeyUnity
@CodeMonkeyUnity 4 жыл бұрын
Yes Havok is a third-party Physics engine used by many AAA games and yes it has a paid license. Not sure how much it will end up being, it's still available as a free trial. Unity Physics on the other hand is free included in Unity.
@zhongyechen7639
@zhongyechen7639 3 жыл бұрын
I am new to unity, I don't know why I give my entity to rigibody. My entities will fall to the bottom of the map, I am sure I have added colliders. Mine is the need to detect the entities near each entity. In addition to using rigibody.index. Is there any other way to get entity? does there have collider.index somthing like that. I check unity.physic, I need to use Overlap query to do that. Thank you. I am not sure what to do, I am not sure do you have these kind of tutorial. if has, please let me know.. Thanks very much.
@seanloughran6714
@seanloughran6714 4 жыл бұрын
Really awesome video. I know its in its early stages, but who man they need to make Raycasting way less verbose.
@CodeMonkeyUnity
@CodeMonkeyUnity 4 жыл бұрын
Yeah the Raycast is great in how many options it has but it definitely needs a simplified utility function.
@ajaykumar-qw3qr
@ajaykumar-qw3qr 4 жыл бұрын
can't find the "Physics shape " under DOTS and Physics.why?
@mattn5933
@mattn5933 28 күн бұрын
Hello, With Unity 6 coming out and DOTS being a highlight of it, are there any plans on updating any of these tutorials?
@CodeMonkeyUnity
@CodeMonkeyUnity 27 күн бұрын
Yup! KZbin doesn't support updating videos but I plan to remake them using Unity 6, I'm currently playing with DOTS Physics right now for my upcoming DOTS RTS course
@BRINK2011THEGAME
@BRINK2011THEGAME 4 жыл бұрын
DOTS implement 2D physics as well?
@Decurion
@Decurion 4 жыл бұрын
In scene start. My objects destroyed, why? I dont see cube and sphere.
@Decurion
@Decurion 4 жыл бұрын
Can i used colisions, and dont use phisics simulation?
@SimplyVanis
@SimplyVanis 4 жыл бұрын
Will the DOTS code will become shorter? It looks like a lot of code for really simple mechanics trying to achieve. And the code seems to repeat for entities as well. Is it because the DOTS is still in development?
@CodeMonkeyUnity
@CodeMonkeyUnity 4 жыл бұрын
It's still very much in development and the amount of code is constantly being simplified so yes I assume it will continue in that direction.
@neon1595
@neon1595 4 жыл бұрын
Hello Code Monkey :) What are your thoughts on the new HAVOK Physics? Should someone like me use it in my project instead of the Unity Physics?
@CodeMonkeyUnity
@CodeMonkeyUnity 4 жыл бұрын
I haven't fully tested both in order to compare but I believe Havok works faster so if speed is absolutely necessary go with Havok. Although Havok is paid for whereas Unity Physics is free.
@usmanmemon
@usmanmemon 4 жыл бұрын
Havok physics is free for unity personnel and maybe is free for plus
@themirlabs
@themirlabs 4 жыл бұрын
using Unity.Physics dose not work for me. im not sure why but that extension dosent exsist. i have installed the physics package like stated in the video. PLEASE HELP!!! also love your videos. a tutorial on making a space game with realistic physics would be awesome. i wanna make spaceships!
@iCraftDay
@iCraftDay 3 жыл бұрын
if your rigidbodys don't fall down, install Havoc physics package (I think)
@Kidopya
@Kidopya 3 жыл бұрын
Aren't there Physics Shape and Physics Body for 2D sprites?
@GunslingerP
@GunslingerP 4 жыл бұрын
Could you make a tutorial on everything needed to start a new project from scratch? I can't seem to figure out why whenever I start a new project, add entities, add physics etc... I get a lot of exceptions and nothing is working.
@CodeMonkeyUnity
@CodeMonkeyUnity 4 жыл бұрын
If you want to work with DOTS then open a completely blank project and install the Entities package, in doing so it will automatically get all the related dependencies like Jobs. If you add the Physics package afterwards you might get some issues with the Performance API, you need to manually select the correct versions, I'm guessing that's an issue that will be solved soon.
@muuubiee
@muuubiee 4 жыл бұрын
Have you done any tests to see what kind of performance difference this gives?
@CodeMonkeyUnity
@CodeMonkeyUnity 4 жыл бұрын
Not yet, I'm planning some torture tests soon, but if the other DOTS tests I've done are any indication that this can be 1000x faster.
@jamesmillerjo
@jamesmillerjo 4 жыл бұрын
Can you explain why velocity of both EntityA & EntityB would be modified when collision triggered? Isn't A&B refers Ball & Ground? Why only ball jumps up despite of both entity's velocity changed?
@CodeMonkeyUnity
@CodeMonkeyUnity 4 жыл бұрын
The Floor entity does not have a Velocity component, it only has a Collider component so that's why it doesnt move. If you add a Rigidbody or a Physics Body component then it will end up with a Velocity component which will end up both jumping.
@jamesmillerjo
@jamesmillerjo 4 жыл бұрын
@@CodeMonkeyUnity Oh, so you mean ball can be A or B by collision case, and it's better applying velocity all of them (and nullify v of floor) than taking overhead deciding which one is ball and which one is floor... Is it right?
@CodeMonkeyUnity
@CodeMonkeyUnity 4 жыл бұрын
@@jamesmillerjo Yup the ball can be either A or B. In this simple demo I just tried to modify the PhysicsVelocity or both entities but if you want more specific logic you could add another ComponentDataFromEntity to specifically identify which one of the two is the ball.
@dr_UiD
@dr_UiD 4 жыл бұрын
​@@jamesmillerjo No he is not applying velocity to all of them . He is testing wich one is Ball and wich one is Ground.
@iskatoysen
@iskatoysen 3 жыл бұрын
I can't control any car in demo, how did you do it?
@sachanhardik
@sachanhardik 4 жыл бұрын
The way you did ITriggerEventsJob, i did ICollisionEventJob but I am getting a memory Leak. Any thoughts?
@mathiasjensen2841
@mathiasjensen2841 4 жыл бұрын
Try using the attribute [updateAfter(typeof(StepPhysicsWorld))] on your system
@sachanhardik
@sachanhardik 4 жыл бұрын
@@mathiasjensen2841 Thx
@user-kn8xx9rn6b
@user-kn8xx9rn6b 4 жыл бұрын
我觉得up主很强
@shubhrojyotikabiraj8322
@shubhrojyotikabiraj8322 Жыл бұрын
JobComponentSystem is depreciated and instead SystemBase is used. What modifications are required in code because if i use SystemBase, i cannot get JobHande inputDeps from anywhere
@shubhrojyotikabiraj8322
@shubhrojyotikabiraj8322 Жыл бұрын
I have modified the code here a little (it working but giving errors): protected override void OnUpdate() { JobHandle jobHandle = Dependency; TriggerJob triggerJob = new TriggerJob { physicsVelocityEntities = GetComponentDataFromEntity() }; triggerJob.Schedule(stepPhysicsWorld.Simulation, Dependency); Dependency = JobHandle.CombineDependencies(Dependency, jobHandle); }
@user-xj5hp7xv3x
@user-xj5hp7xv3x 4 жыл бұрын
5:21 when i start scene objects destroyed. Why?
@iCeDrAgOn2025
@iCeDrAgOn2025 4 жыл бұрын
DOTS is definitely going to be a unique beast to work with once it is finally out of preview. I just honestly hope that they come up with a better way of actually controlling the beast that they're unleashing. What I mean by that is, it is so easy to set things up, But after that initial setup getting access to the underlying data can be nightmare. It's kind of like giving your data to a bank to look after (Unity) then having to break in to said bank just to get access to be able to use it and make simple changes to it. Not to be hard on Unity because I think they're moving in the right direction with what they are doing... But at the same time I think that they need to take a step back and really focus. and this is actually where Unreal has an advantage over Unity, Epic they themselves have made a AAA game with their own engine. Unity has not, Sure, Unity has came up with some AAA looking in game footage, but it's not intractable. It's more or less a movie and not so much a game. And making a movie vs a game is completely different, there are so many things to consider. Still keep up the good work and exploring the new tech as it comes out, it's great to see some insight in to how it all works and what is potentially possible.
@CodeMonkeyUnity
@CodeMonkeyUnity 4 жыл бұрын
Are you talking about DOTS Physics specifically or DOTS in general? I agree DOTS Physics does seem a bit too complex but DOTS as a whole is already quite a lot user friendly. They have improved usability tremendously these past 12 months and by the time DOTS Core is out of preview it should be very usable.
@iCeDrAgOn2025
@iCeDrAgOn2025 4 жыл бұрын
@@CodeMonkeyUnity The DOTS Physics seems to be overly cumbersome at this point, especially with what you showed with having to write your own function that is built on the Unit's regular physics. But that in and of itself is partly because it's still in preview so that's understandable that there is going to be some functionality missing. But I was also talking about DOTS in general. Yes it has made leaps and bounds over the past 12 months by adding several QOL features and streamlining the syntax that makes it somewhat easier to work with. But in the end you still have to go though thousands of entities just to find maybe 1 that has met a certain condition. Now to me, that sounds counter productive because it seems to be that the flow control of your program is one way and if you didn't have the mass parallelism provided by BURST it would be worse off than the current GameObject Model that people are used to. Take for example with traditional GameObjects sure there would be iteration to possibly change values on several similar objects, and once that object's data has reached a certain condition it has a way messaging the system that something needs to be done, either through events or some form of other call back feature which can identify that specific object. But with DOTS, right now there is no real way to isolate specific data (at least in the examples I've seen online), if you're creating a job to work on a set of entities, then you have to make another job just to handle entities that have met certain conditions. And to me, that seems more system oriented than it does data. if you have a scene with 50,000 tree entities that have a translation component and 1 player, and you go searching for the player using foreach, but also wanting it's translation so you can move it. it's still going to have to go through all of the trees until it finds the entity with the the player tag and the translation component. Hopefully that will make sense to you. And it could be that I am missing something here. Have they done away with using archetypes which would kind of minimize that problem because then you can just create specific entities based on an archetype and separate them out in to tree and player and just look for the player archetype and completely exclude looking through all the trees
@nukulargames6315
@nukulargames6315 4 жыл бұрын
How well does regular unity physics and DOTS physics play with each other? Like, say DOTS colliders hitting gameobject colliders? Or DOTS rays hitting gameobjects?
@CodeMonkeyUnity
@CodeMonkeyUnity 4 жыл бұрын
They don't interact, they live in completely different worlds. You can mix them in the same scene but they don't collide between systems.
@nukulargames6315
@nukulargames6315 4 жыл бұрын
What about a hybrid approach, using only DOTS physics but still referencing the original gameobject with monobehaviors that aren't DOTS friendly.
@CodeMonkeyUnity
@CodeMonkeyUnity 4 жыл бұрын
@@nukulargames6315 Technically you could have an invisible collider in the DOTS World and on every Update move a GameObject to the same position as the Entity but that is a very convoluted way of doing things.
@medmel2160
@medmel2160 4 жыл бұрын
Would it be possible to use "rigidebody based on assets" in an ECS project just by putting "convert to entity" like you did?
@CodeMonkeyUnity
@CodeMonkeyUnity 4 жыл бұрын
Yes when you add ConvertToEntity it will convert a normal Rigidbody component into a DOTS Physics Body
@medmel2160
@medmel2160 4 жыл бұрын
@@CodeMonkeyUnity great, good to know ! thank you, and amazing video as usual.. :)
@EYErisGames
@EYErisGames 6 ай бұрын
@@CodeMonkeyUnityWhere is the ConvertToEntity script?
@dabspace5541
@dabspace5541 4 жыл бұрын
Hey I am completely new to game development so which video should I see
@CodeMonkeyUnity
@CodeMonkeyUnity 4 жыл бұрын
If you're completely new to Unity start off with the Basics playlist kzbin.info/aero/PLzDRvYVwl53vxdAPq8OznBAdjf0eeiipT After that look through the video list for more beginner tutorials or try following one of the complete simple games I have like Flappy Bird and Snake kzbin.info/www/bejne/mGa6oaGfbrCDn80
@dabspace5541
@dabspace5541 4 жыл бұрын
Code Monkey ,thanks a lot
@hamsg
@hamsg 3 жыл бұрын
idk what to think about dots lol making a gameobject jump when it hits the trigger but its 10x the code length and complexity.
@LukeAps
@LukeAps 2 жыл бұрын
The point is that it's 100x faster. You can have 10000 DOTS balls jumping at 120fps. Or. 100 normal balls jumping at 30fps. 6 months old, but still.
@shaunhall7894
@shaunhall7894 4 жыл бұрын
Code Monkey. What a great vid man. Side by side comparison of using a gameobject vs DOTS. Brilliant! I hate to request another idea on top of all the others we are suggesting for you, but #Geri mentioned on here of doing a small game in DOTS. I second that idea. Similar to a Flappy Bird style game..? I would love to give you a one-time donation. You have a Paypal, GoFundMe?
@CodeMonkeyUnity
@CodeMonkeyUnity 4 жыл бұрын
Yeah a small complete game is definitely something I'm looking into. You can get the Game Bundle which really helps and you get some cool games to play! unitycodemonkey.com/gamebundle.php Thanks!
@divyanthj
@divyanthj 3 жыл бұрын
Where do I find the package files? I can't find it in my package manager.
@Lelefant_
@Lelefant_ 3 жыл бұрын
To see preview packages, enable them in the settings inside the Package Manager. But, with 2020.1 they removed the pre-preview packages, e.g. the hybrid renderer. They describe a workaround here: docs.unity3d.com/Packages/Installation/manual/index.html In short, you can click "Add package from git URL" and paste the corresponding unity package name (e.g. com.unity.rendering.hybrid )
@agtechart
@agtechart 4 жыл бұрын
Hi CodeMonkey! What is exactly World.DefaultGameObjectInjectionWorld ?
@CodeMonkeyUnity
@CodeMonkeyUnity 4 жыл бұрын
It's the default world that gets created and what the objects with the ConvertToEntity script get instantiated into.
@agtechart
@agtechart 4 жыл бұрын
@@CodeMonkeyUnity got it, thanks so much!
@jean-michel.houbre
@jean-michel.houbre 4 жыл бұрын
Hello, difficult to use the project on Github: tons of errors ^^. On your video, the InputSystem package does not seem to be installed. Because of namespace errors, I installed it, and I went from 110 to 22 errors : \ The remaining errors are mainly "Assets \ Common \ InputActions.cs (791,39): error CS1061: 'InputActionAsset' does not contain a definition for 'GetActionMap' and no accessible extension method 'GetActionMap' accepting a first argument of type 'InputActionAsset 'could be found (are you missing a using directive or an assembly reference?) " . I will watch the video quietly and try again when I can understand these errors...
@CodeMonkeyUnity
@CodeMonkeyUnity 4 жыл бұрын
What version did you open it on? The samples github comes with the entire project so it should already have all the packages installed correctly, open the project folder with 2019.3.0f1
@jean-michel.houbre
@jean-michel.houbre 4 жыл бұрын
@@CodeMonkeyUnity 2019.3.0f1. It is nice to want to help me, but I think that I am not yet learned enough on Unity to advance on this subject. I prefer to wait until I have a little more knowledge, in particular on the new input system. I followed the rest of the video, I almost finished it, it is very interesting (still struggling with the English language, despite the efforts of those who make the subtitles). I am trying to reproduce your actions, and I will point out very small difficulties: - when you type the code, you are quite often at the bottom of the screen, where the subtitles are located. So pause, move the subtitle bar, resume reading. It's just boring. - sometimes you go very quickly with the mouse, without commenting. You must then go back and scan the screen. Nothing insurmountable, it's just boring. Your videos deserve to have more views, and I find them really very interesting, we always learn something from them. In fact, I watch very few English channels, but the lack of quality French channels is a powerful motivator ... And in addition, I feel that my level of English is improving :). As I wrote to you (it seems to me that I used the form on your site), I bought your games, and I made comments and proposals. I had a good time with these games, and I still do. Thank you again for all these videos and happy new year 2020.
@nnNothing
@nnNothing 2 ай бұрын
it's basically completely different from old system like learning from different Game Engine
@marvalgames3939
@marvalgames3939 4 жыл бұрын
Great as always. Another inept tutorial?? That's what it sounds like to me for some reason.
@CodeMonkeyUnity
@CodeMonkeyUnity 4 жыл бұрын
Heh it's "in-depth" but yeah I can see how it sounds a bit odd
@random_precision_software
@random_precision_software 4 жыл бұрын
Can you do the HAVOK physics as well?
@CodeMonkeyUnity
@CodeMonkeyUnity 4 жыл бұрын
Yes, you can easily swap between the two
@random_precision_software
@random_precision_software 4 жыл бұрын
@@CodeMonkeyUnity I should of made it clearer ...can you do a video on it..I tried and got weird results lol
@tranceemerson8325
@tranceemerson8325 4 жыл бұрын
Epic Hello World Program.
@atur94
@atur94 4 жыл бұрын
ECS is another level of coding. Extremely hard
@47Mortuus
@47Mortuus 4 жыл бұрын
Is it still accurate? Is unity physics changing constantly at the moment?
@CodeMonkeyUnity
@CodeMonkeyUnity 4 жыл бұрын
It's still in development but I believe everything in the video still works
@highlewelt9471
@highlewelt9471 4 жыл бұрын
Where is the documentation shown in the video? God I hate to navigate Unity's online resources
@taobowen2016
@taobowen2016 3 жыл бұрын
Unfortunately the scripts from DOTS/Physics has gone...
@taobowen2016
@taobowen2016 3 жыл бұрын
All right, install unity physics from package manager and then scripts come out..
@likeyou3317
@likeyou3317 4 жыл бұрын
The ball with rigidbody stops bouncing after a second, losing all energy. :/ + the raycast is not accurate, looks like the center of sphere collider is 1cm higher than the actual shpere, but its not. So I have to 1cm higher.
@CodeMonkeyUnity
@CodeMonkeyUnity 4 жыл бұрын
Even if you give it perfect bounciness the underlying values are stored in floats so you don't have infinite precision which does mean that eventually it all comes to a stop.
@likeyou3317
@likeyou3317 4 жыл бұрын
@@CodeMonkeyUnity Thats an answer I didnt expect. Thanks for tutorial, gonna work with dots so I grab anything i can find
@NachoMan154
@NachoMan154 4 жыл бұрын
My Sphere does not fall. Without converting them to entities it works! :/
@sorackengamer6507
@sorackengamer6507 4 жыл бұрын
Hi!
@JamesWjRose
@JamesWjRose 4 жыл бұрын
The line: return triggerJob.Schedule(stepPhysicsWorld.Simulation, ref buildPhysicsWorld.PhysicsWorld, inputDeps); is showing an issue: the call is ambiguous between the following methods or properties: IBodyPairsJobExtensions.Schedule(T, Simulation, ref PhysicsWorld, JobHandle) and ICollisionEventJobExtensions.Schedule(T, ISimulation, ref PhysicsWorld,JobHandle) I have posted the issue here: forum.unity.com/threads/itriggereventsjob-schedule-compile-error.877681/ and if you or anyone has the solution, or even a clue.... If I find the solution I will post back. ------------------------- EDIT 1: I attempted to run the Unity Physics samples, and they too get this error. So it seems it's something to do with my system. I will update again when I find something else. EDIT 2: Solved. I was using Visual Studio Community 2015 and upgraded to Visual Studio Community 2019 and the conflict was resolved. I have no idea why upgrading the IDE resolved the conflict between two functions... but it worked for me. ------------------------- Thanks for this video and all of them, they are a great help.
@twitchizle
@twitchizle 4 жыл бұрын
All i want local wi-fi based multiplayer game.
@lieQT
@lieQT 4 жыл бұрын
Doing the networking for games is relatively abstracted from the actual hardware, so learning client/server and p2p architecture will be relevant regardless whether its LAN/WiFi/WAN/p2p - applications dont actually care whether their data is sent via wifi, ethernet cables or some other fake adapter as you might see in a vm. Youd wanna start looking into UDP, bidirectional communication etc
@gawer33
@gawer33 3 жыл бұрын
nice one but can we off and on that feature without uninstalling unity dots physics
@anonymousone4824
@anonymousone4824 3 жыл бұрын
Idk why but 2:18 make me laugh
@siddharthtrivedi3322
@siddharthtrivedi3322 4 жыл бұрын
If Unity started adding this kind of complex features then they will easily lose their users because in the market game engines are coming those make your life more easy day by day. One name is Buildbox, they will provide big competition in this.
@CodeMonkeyUnity
@CodeMonkeyUnity 4 жыл бұрын
Game Objects and MonoBehaviours aren't going anywhere, if your game has no issues with performance then by all means keep making games as you've always done. DOTS is simply another option that is extremely performant. There are many (most) games which have limited design due to performance limitations, that is what DOTS is meant to solve.
@siddharthtrivedi3322
@siddharthtrivedi3322 4 жыл бұрын
@@CodeMonkeyUnity Yes I understand your point and you are doing really good :) I am just talking generally, maybe Unity make this thing compulsory in the future as like they will do LDRP as their default render pipeline.
@cyberpegasus1311
@cyberpegasus1311 4 жыл бұрын
Is this chinese?
@CodeMonkeyUnity
@CodeMonkeyUnity 4 жыл бұрын
What is chinese?
@cyberpegasus1311
@cyberpegasus1311 4 жыл бұрын
@@CodeMonkeyUnity dots in general, i didn't understand anything xD
@alexandreamiel1865
@alexandreamiel1865 3 жыл бұрын
protected override void OnUpdate() { CollisionWorld collisionWorld = m_BuildPhysicsWorld.PhysicsWorld.CollisionWorld; UnityEngine.Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition); Vector3 rayEnd = ray.origin + ray.direction * 100; if (Input.GetMouseButtonDown(0)) { // Vector3 mousePos = Camera.main.Scr IgnoreTransparentClosestHitCollector collector = new IgnoreTransparentClosestHitCollector(collisionWorld); var raycastInput = new RaycastInput { Start = ray.origin, End = rayEnd, Filter = CollisionFilter.Default }; collisionWorld.CastRay(raycastInput, ref collector); RaycastHit hit = collector.ClosestHit; Debug.Log(hit.Entity); } }
@Jewelsonn
@Jewelsonn 3 жыл бұрын
Too Time consuming,
Unity DOTS - What changed?
13:00
Code Monkey
Рет қаралды 37 М.
What are Subscenes in Unity? (Massive Worlds!)
15:51
Code Monkey
Рет қаралды 94 М.
Increíble final 😱
00:37
Juan De Dios Pantoja 2
Рет қаралды 18 МЛН
When Steve And His Dog Don'T Give Away To Each Other 😂️
00:21
BigSchool
Рет қаралды 15 МЛН
Unity DOTS vs Handbuilt: Sample Project
27:56
Nick Caston
Рет қаралды 674 М.
I Made a Neural Network with just Redstone!
17:23
mattbatwings
Рет қаралды 510 М.
How Do Games Render So Much Grass?
15:52
Acerola
Рет қаралды 316 М.
How I would approach gamedev (if I had to start over)
18:34
BiteMe Games
Рет қаралды 67 М.
Pathfinding in Unity DOTS! (Insane Speed!!!)
24:56
Code Monkey
Рет қаралды 130 М.
6 Years of Learning Game Development
9:02
Codeer
Рет қаралды 2,3 МЛН
Modular Character System in Unity (Move, Attack, AI, Pathfinding)
21:16
Superpositions, Sudoku, the Wave Function Collapse algorithm.
14:28
Martin Donald
Рет қаралды 678 М.
Increíble final 😱
00:37
Juan De Dios Pantoja 2
Рет қаралды 18 МЛН