Mesh Deformation : Beginners Procedural Generation EP 7 - Unity3D

  Рет қаралды 31,565

CodingWithRus

CodingWithRus

Күн бұрын

Пікірлер: 80
@isaacs1217
@isaacs1217 3 жыл бұрын
Coming from a fellow Unityer(?), good job with explaining this, now when people ask me for "how to code mesh deform pls", I can send them this... Yes, I'm bad at explaining... Deserve way more than 247 subs bro, I just gave you one extra!
@CodingWithRus
@CodingWithRus 3 жыл бұрын
Thank you, I appreciate the kind words!
@isaacs1217
@isaacs1217 3 жыл бұрын
@@CodingWithRus Anytime!
@larsmaas07
@larsmaas07 2 жыл бұрын
I am working on a sand castle city builder project and this video definitely helped me. Thanks :D
@CodingWithRus
@CodingWithRus 2 жыл бұрын
Glad it helped!
@larsmaas07
@larsmaas07 2 жыл бұрын
I am using marching cubes now because the system you use loses polygon resolution/typology when deformed :)
@CodingWithRus
@CodingWithRus 2 жыл бұрын
That's good, marching cubes is the correct implementation for what you're creating! Good luck with your project :)
@iliketowatchducks
@iliketowatchducks Жыл бұрын
Thanks for making this video so simple and straightforward.
@CodingWithRus
@CodingWithRus Жыл бұрын
Glad you enjoyed! Thanks for the comment :)
@iliketowatchducks
@iliketowatchducks Жыл бұрын
Yes! I'm trying to make a sort of isometric 3D terrain if you can imagine that, maybe like throw in some low Polly astethic vibes, maybe like that 45 degree orthographic view type situation. A classic imo. And I wanted to try have a way of deforming the hills or whatever is there, untill it can only reach the base maybe. So still trying to figure out how to make the map etc, getting there , but this video's going to help me get started on the deforming for sure. Super helpful.
@CodingWithRus
@CodingWithRus Жыл бұрын
Sounds awesome! Good luck!
@freshplay2
@freshplay2 9 ай бұрын
meennn..You are a prophet of help.thanks.saved me alot of effort..thanks you.
@josimar8497
@josimar8497 4 жыл бұрын
you explaned so well, thanks and keep it up with the videos!
@CodingWithRus
@CodingWithRus 4 жыл бұрын
Thank you!
@RajkumarDarbar
@RajkumarDarbar 3 жыл бұрын
Too good content !! Thanks a lot for making it! Much appreciated !!
@CodingWithRus
@CodingWithRus 3 жыл бұрын
Glad you enoyed! Thank you for the comment.
@aichayasmine2168
@aichayasmine2168 4 жыл бұрын
Congrats on 100 subs! Keep the videos coming 😍🎉
@CodingWithRus
@CodingWithRus 3 жыл бұрын
Thank you! Will do!
@kaidastudios
@kaidastudios 3 жыл бұрын
Please keep making more. Amazing information! Thank you!
@CodingWithRus
@CodingWithRus 3 жыл бұрын
Thank you!
@dertobbe1176
@dertobbe1176 Жыл бұрын
This is great!
@calendulaprox2155
@calendulaprox2155 Жыл бұрын
Thank you for this! its very useful :)
@neoteraflare
@neoteraflare 2 жыл бұрын
Watching this in 2022. You are now over a thousand subs!
@CodingWithRus
@CodingWithRus 2 жыл бұрын
Big achievement for me! Thanks for commenting :)
@barrykelly7437
@barrykelly7437 2 жыл бұрын
Great video thanks!
@CodingWithRus
@CodingWithRus 2 жыл бұрын
My pleasure, thank you :)
@PiterTraceurFA
@PiterTraceurFA 2 жыл бұрын
Awesome vid man, helped me a ton even though I'm working in UE4
@CodingWithRus
@CodingWithRus 2 жыл бұрын
Glad I could help
@alirezaielal8293
@alirezaielal8293 3 жыл бұрын
thank you so much for this great video . keep going body . you explained it very wellll !!
@CodingWithRus
@CodingWithRus 3 жыл бұрын
Thank you! Will do!
@unmxtiviert
@unmxtiviert 3 жыл бұрын
Im the 510 subcriber Congrats!!!!!!
@CodingWithRus
@CodingWithRus 3 жыл бұрын
Thanks David!!
@JHE_Box
@JHE_Box 3 жыл бұрын
Great video, super clear explanations 😊. From one tiny channel to another, keep it up!
@CodingWithRus
@CodingWithRus 3 жыл бұрын
Thank you!
@k1ng401
@k1ng401 2 жыл бұрын
You never did the 7.5? This was a very easy to understand tutorial. Be interested to know how I can detect where I’m touching the mesh with a game object rather than the mouse. Also how to do it with a copy of the Vertices rather than a Reference (if that is indeed quicker).
@CodingWithRus
@CodingWithRus 2 жыл бұрын
I know :(, will be coming soon. I have it all planned out just need to film, edit upload. You can use the mech collider component to find the point where the game object hit (you can use bullets colliding with the mesh to deform)
@falf_87
@falf_87 11 ай бұрын
Hi, This tutorial has been great! How do I get this to work in 3D, either with a cube, capsule or custom mesh? I was also wondering how you would change the shape of the mesh based on collision with another object, not with the mouse? Any help would be great. Thanks
@gutzimmumdo4910
@gutzimmumdo4910 Жыл бұрын
is there a way to make terraces or sharp walls like straight walls insted of shagged ones? very nice list btw good work.
@joshuasmith756
@joshuasmith756 Жыл бұрын
This is a great video and it's really helpful. Although I'm having trouble while trying to translate this to a sphere. I'm getting a NullReferenceException on line 30, which would be "mesh.RecalculateNormals();" in my code. Is there a quick fix to this?
@אורימימון-ע3ה
@אורימימון-ע3ה Жыл бұрын
hey ty for the vidoes! i want to ask how to make Procedural Generation just for a monsters
@ahxel8554
@ahxel8554 3 жыл бұрын
thank you!
@CodingWithRus
@CodingWithRus 3 жыл бұрын
You're welcome!
@shabadava62
@shabadava62 2 жыл бұрын
Hi Rus! First of all: awesome video, you make me understand a subject that i was trying to learn for a damn while. Tysm Now, I have some issues to implement the controller to another context: So, i want to make the deformation acording to the position of a character controller on the scene, that's not the greatest problem right now, but the fact that i want to add a curve to the deformation in order to make it more smoothly (according to the position of this character controller). I never managed curves for this kind of things before, but it seems as a nice option. Any suggestions?
@CodingWithRus
@CodingWithRus 2 жыл бұрын
Glad you liked it! For your case it'll be lots of maths unfortunately BUT a not so optimized way would be to use a "invisible" 3D sphere attached to the character controller and then deform the terrain to the shape of the sphere. Hope that helps!
@joewilliams8286
@joewilliams8286 3 жыл бұрын
Great channel mate, akin to Code Monkey / Sebastian Lague when it comes to the quality of the information you provide! Got yourself a new subscriber, can't wait to see what you release next
@CodingWithRus
@CodingWithRus 3 жыл бұрын
Thanks very much! Really appreciate the kind words
@kuzmychmaksym3843
@kuzmychmaksym3843 10 ай бұрын
2.2K subscribers are watching this now, bro)
@last_thylacine
@last_thylacine Жыл бұрын
Why do we add 1 to sqrMagnitude in the force formula?
@Famosy1
@Famosy1 3 жыл бұрын
Did you have discord pls?
@CodingWithRus
@CodingWithRus 3 жыл бұрын
Hi, not yet but will be creating one soon!
@erikhokis6292
@erikhokis6292 2 жыл бұрын
Thank you for great video, anyone know why this working only on plane mesh with xz scale 1?when i import mesh or scale plane it not working.
@torstone1009
@torstone1009 3 жыл бұрын
Is it possible to use this but instead of just deforming you could remove parts of the mesh? I want to make a snow system where you can roll a snowball in the snow, the snow will disappear and the snowball will grow
@CodingWithRus
@CodingWithRus 3 жыл бұрын
Hi, I really wouldn't recommend removing parts of the mesh if you're not certain what impact this would have. Instead deform it (like in the video) to lower the vertex's. Bare in mind I've never tried to create a snow type system. Thanks and hope that helps!
@torstone1009
@torstone1009 3 жыл бұрын
@@CodingWithRus Yep, deforming was the right way to go! Thanks a lot
@k1ng401
@k1ng401 2 жыл бұрын
When I attach this script to my procedurally generated mesh I get a “Object Reference not set to an instance of the Object” in the RecalculateMesh() step at the end of Update
@CodingWithRus
@CodingWithRus 2 жыл бұрын
Hey, do you have a mesh collider attached to the game object?
@k1ng401
@k1ng401 2 жыл бұрын
@@CodingWithRus I'm not sure what the original problem was but I worked out how to do the OnCollisionEnter in order to have a colliding object deform the mesh and that works great with a Primitive but not with my Generated Mesh. I had to move the GetComponent step into an OnBecameVisible since my mesh does not actually exist when Start is called. And that seems to work ok. modifiedVerts are being updated with a down component when something falls on them. BUT the RecalculateMesh step although it's being called ok, doesn't do anything when it's my Calculated Mesh. The mesh doesn't change shape like it does when the script is attached a primitive plane. Something about the nature of my Generated Mesh but it seems to have all the correct attributes. It has a Filter, I can get the mesh.vertices.length
@CodingWithRus
@CodingWithRus 2 жыл бұрын
Hey, I suspect it will be your mesh collider, double check that it's attached and there is a call on the start method for it. Think that will fix your issue
@k1ng401
@k1ng401 2 жыл бұрын
@@CodingWithRus I worked it out. My Generated Mesh DOES change shape, just not visually where the colliding object is hitting it. It seems to be deforming the mesh's local coordinates in line with the collision's global coordinate (for example my ball is hitting the mesh at Global coordinate 0,0,0 and the mesh is deforming at vertex 0,0,0 but because I have dragged my mesh to position it so that the centre of the plane is under the ball, that 0,0,0 vertex is at global coordinate -10,0,-7. Do I need to position my Generated Mesh Game Object at 0,0,0 and reposition the ball, camera etc so that they are in the middle? Or is there a way I can translate the collision coordinate to be relative to the Mesh's position?
@HerenowMOBUDUON
@HerenowMOBUDUON 2 жыл бұрын
hello, I would like to make a restriction on the height and depth of the mesh change, what code should I insert?
@CodingWithRus
@CodingWithRus 2 жыл бұрын
Hi, you need to look at using mathf.clamp for the changeable values. Here's the link, it should give you the run down of how to imement it. docs.unity3d.com/ScriptReference/Mathf.Clamp.html
@HerenowMOBUDUON
@HerenowMOBUDUON 2 жыл бұрын
@@CodingWithRus thx man!
@CodingWithRus
@CodingWithRus 2 жыл бұрын
Anytime :)
@mrsingh2595
@mrsingh2595 3 жыл бұрын
Bro when are the next videos coming
@CodingWithRus
@CodingWithRus 3 жыл бұрын
Episode 8 out now!
@pennd44
@pennd44 11 ай бұрын
For some reason, the mesh only deforms for me when the camera is at x:0, y: anything, z:0. Does anyone know why?
@aus602
@aus602 2 жыл бұрын
Hellooo im sorryyy but how do i solve this Object reference not set to an instance of an object MeshController.RecalculateMesh()
@CodingWithRus
@CodingWithRus 2 жыл бұрын
Hey! You're missing a reference to the mesh controller! If on the same gameobject user GetComponent if on a different object you can use FindObjectOfType
@aus602
@aus602 2 жыл бұрын
May i email you my code and screenshot as im still using same gameobject and find errors only.. could you help me 🥺 Im SO Sorryy.. Im just a school student doing this for my project
@CodingWithRus
@CodingWithRus 2 жыл бұрын
Hey, best thing to do is to join the discord and then post your code in the #code-help channel. And then I can take a look :)
@cancandan4327
@cancandan4327 2 жыл бұрын
Great!
@CodingWithRus
@CodingWithRus 2 жыл бұрын
Thank you
@Pilzefresser
@Pilzefresser 3 жыл бұрын
how do I need to change the code if I want to do it with a wall?
@CodingWithRus
@CodingWithRus 3 жыл бұрын
You'll just have to flip the axis, so instead of using the z axis, you use the y axis. Thanks,
@Pilzefresser
@Pilzefresser 3 жыл бұрын
@@CodingWithRus where do I set the axis? I rotated the plane. But it only deforms the plane/wall when I click on the ground instead of the wall. How do I need to change the raycast code?
@nanifiqueyt
@nanifiqueyt 2 жыл бұрын
@@Pilzefresser not 100% sure but I think you could just replace Vector3.up / Vector3.down to Vector3.right / Vector3.left
@RamjiR-u4c
@RamjiR-u4c Жыл бұрын
not at all working.. I followed the same procedure nothing works for me. The variable verticies you are setting is never used in the script.
@CodingWithRus
@CodingWithRus Жыл бұрын
Hi, the source code is attached in the description. Could you give that a go please. I've rechecked the code and it's working. Thanks!
@TheSateef
@TheSateef 4 жыл бұрын
modifiedVerts should be a copy of the mesh, not a reference. do a new Vector3[length] and copy every cell. the way you are doing it now modifies the mesh points directly and is very slow. see catlikecoding.com/unity/tutorials/mesh-deformation/
@CodingWithRus
@CodingWithRus 3 жыл бұрын
Yes! You're absolutely right, it completely slipped my mind when recording this. When you do it the way that I have done it on the code, you're pointing to a reference of that array rather than having a variable create a new array in memory.
Une nouvelle voiture pour Noël 🥹
00:28
Nicocapone
Рет қаралды 9 МЛН
MESH GENERATION in Unity - Basics
11:10
Brackeys
Рет қаралды 459 М.
The Problem With Procedural Generation
17:57
Acerola
Рет қаралды 248 М.
10 Gamedev Libraries For 10 Needs (used by AAA companies)
11:33
Oskar Schramm
Рет қаралды 29 М.
Unity VR Tutorial Series - Deformable Objects
8:16
avarioXR
Рет қаралды 2,9 М.
Mesh Generation : Beginners Guide EP 5 - Unity3D
11:18
CodingWithRus
Рет қаралды 13 М.
Reinventing Minecraft world generation by Henrik Kniberg
49:41
Making Procedural Music in Unity
10:39
Ryan Hedgecock
Рет қаралды 32 М.
How I Learned Procedural Generation
5:36
Lejynn
Рет қаралды 273 М.
A new way to generate worlds (stitched WFC)
10:51
Watt
Рет қаралды 547 М.
I Remade Avatar Water VFX in 100 Hours
11:38
ErikDoesVFX
Рет қаралды 2,4 МЛН
Une nouvelle voiture pour Noël 🥹
00:28
Nicocapone
Рет қаралды 9 МЛН