How to Optimise Mesh Colliders [Unity Tutorial]

Поделиться
HTML-код
  • Опубликовано: 5 фев 2025
  • Mesh colliders are a funny thing... They're extremely useful for adding detailed collisions to complex meshes, but on the other hand they'll DESTROY the performance of your game if used incorrectly. Luckily, there's a solution to that!
    Join me and learn your way through the Unity Game Engine, the C# language and the Visual Studio editor. Remember, if this video was useful then DROP A LIKE! 👍
    Model: free3d.com/3d-...
    💯 Want to help me out and allow me to keep making these tutorials? Consider supporting the channel on Patreon:
    / comp3interactive
    😍 AWESOME high quality 3D game assets available here:
    shop.runemarks...
    🤩 SPONSORED LINKS:
    www.gigatank30...
    / gigatank3000
    💬 Join the Discord community here:
    / discord
    📱 Find us on social media for more Tips and Tricks:
    / comp3interactive
    / comp3interactive
    / comp3int
    📱 Play our games for FREE here on Google Play:
    bit.ly/2TisAQo #UnityTutorial #Unity3D #Comp3interactive #GameDev

Комментарии • 55

  • @ogulcanzorlu
    @ogulcanzorlu 3 года назад +28

    Very useful tip. Also Unity's ProBuilder can be used to create the fake mesh. Same fake mesh can also be set only to cast the shadows of the model, when the player is far away enough.

    • @comp3interactive
      @comp3interactive  3 года назад +8

      It surely can, personally I'm not a fan of Pro Builder, I just find it clunky to use but I'm used to using Blender and 3D modelling in general. All about what you're comfortable using I suppose

  • @DiegoSynth
    @DiegoSynth 3 года назад +3

    Excellent video, very well done, to the point, great explanation and rich content. Very clear voice and narration. Thank you very much and please keep it up!

  • @panickal
    @panickal 2 года назад +6

    My problem is using rigidbodies with mesh colliders. Because unity doesn't support non kinematic rb with non convex mesh collider

    • @aussieraver7182
      @aussieraver7182 3 месяца назад

      Same, I had to make the decision to change my workflow and simply setup the collision directly in Unity, using the primitive colliders.
      It's a bit more time consuming than creating the collider meshes from your 3D application since its not as accurate to shape the colliders, but its functional and more optimised.

  • @delcien9697
    @delcien9697 3 года назад

    Thnx for this video! ive been trying to figure this out today, u explained it brilliantly! :)

  • @rachapongwatana3868
    @rachapongwatana3868 2 года назад

    Thank you so much for sharing us for very nice tricks to work with Mesh Colliders.

  • @GamerReality
    @GamerReality 10 месяцев назад +1

    Hello, thank you for teaching this method, but I have a question about performance considerations. A box collider has 6 faces, so would a custom beveled box collider with 24 faces and a mesh collider without the convex option take 400% more calculation? Basically, are the number of faces on a mesh collider proportional to the performance cost, or can I at least plan it this way? I’m making a physics multiplayer VR game that needs accurate colliders, which is why I ask.

  • @raphaelrtf
    @raphaelrtf 3 года назад

    Hi Mike, Raph here. Another great tutorial, thank you!

  • @AhmedRamadan-ke8lo
    @AhmedRamadan-ke8lo 2 года назад

    it is good teqnique for quick open world for individual developer to make less time

  • @km3-sdn4yehembangkauh59
    @km3-sdn4yehembangkauh59 Год назад

    I want use mesh collider and rigidbody (use gravity), but when i set rigidbody (use gravity) its should use convex at mesh collider. how i can use gravity without convex in mesh collider?

  • @mysterious_monolith_
    @mysterious_monolith_ 10 месяцев назад

    That's amazing! Great video!

  • @kobyfr
    @kobyfr 2 года назад +1

    how would you add a non-convex mesh collider to your object if it has a rigidbody component?

  • @erdemozsumbull
    @erdemozsumbull 11 месяцев назад

    Thank you! Nice tutorial video

  • @DianaDigipaja
    @DianaDigipaja Год назад

    Thanks for the great video! I followed your instructions but for some reason it didn't quite work for me. I think my problem is that the Mesh Collider Components Cooking Options is still stucked on Everything where as yours changed automatically to Mixed (7:04). Any idea why or what's wrong?

  • @3zzzTyle
    @3zzzTyle Год назад

    Optimal collision meshes, regardless of the engine, must be convex (so no inset + extrude) and without holes.
    This will still work for some purposes, but is more expensive and bug-prone.
    It's better to make several convex collision meshes and import them all.

  • @mohamadjeldeh1094
    @mohamadjeldeh1094 2 года назад +1

    that is great, but isn't helpful because you may have to transform the shape to convex
    I need to adjust the polygons in convex shape collider and didn't find anything about that topic

  • @foreducation408
    @foreducation408 2 года назад

    such a simple and awesome video, thanks for making this.

  • @nickolayfetlistov4416
    @nickolayfetlistov4416 Год назад

    Great video! It's perfect! Thank you!

  • @LuxArt1000
    @LuxArt1000 Год назад

    Wow thank you so much u such a boss

  • @tanimator87
    @tanimator87 3 года назад

    This was awesome thanks a lot for this tutorial

  • @laytonvicars4606
    @laytonvicars4606 3 года назад

    Thank you very much! Very informative video!

  • @pg1448
    @pg1448 2 года назад

    Thanks. Very helpful

  • @aliqaheri2459
    @aliqaheri2459 3 года назад

    Great video. Thanks!

  • @ThermalSnakeMerc
    @ThermalSnakeMerc 2 года назад

    Perfect video.

  • @Rfkfuzzygaming
    @Rfkfuzzygaming 5 месяцев назад

    I know its been like 3 years but im trying to do a map

  • @hernandonj
    @hernandonj 3 года назад +1

    Great tip. I wonder if this method is still good for moving the tank for example through a city, because it is needed to collide with ground and other game objects

    • @comp3interactive
      @comp3interactive  3 года назад +2

      Yeh man this method would work perfectly. You might need to add a few more boxes for the tracks / any other dynamic parts just to get more detailed collision detection, but any way it would be 100x better than using a raw mesh collider

  • @zeroerror2338
    @zeroerror2338 2 года назад

    Very nice tutorial with amazing trick for improving performance of games.But i ran into a little problem whenever i add my collider mesh to the mesh collider component it rotates opposite, to the actual model.

    • @UnityTrap
      @UnityTrap 2 года назад

      I think you can fix it by going into Object>Apply>All Transforms, I haven't had my pc for almost 2 months so I don't really remember.

  • @iriaizanami86
    @iriaizanami86 10 месяцев назад

    tHANKS

  • @workthenplay
    @workthenplay 2 года назад +1

    Great tutorial! What happens if your mesh animates and moves? Can you share how you would do that?

  • @AJ-nm5fx
    @AJ-nm5fx 3 года назад

    Great stuff, very informative! SUBBED

  • @oozly9291
    @oozly9291 3 года назад

    Very useful!

  • @Squidmoto3
    @Squidmoto3 3 года назад +1

    Wouldn't a way faster way be to just duplicate the mesh and use the limited dissolve tool? That way it gives you a slider to adjust how detailed you want it to be. It won't ever get down to primitive shapes like you made here, but it'd get pretty close and it'd be like x10 faster.

    • @maxtoka5867
      @maxtoka5867 2 года назад +1

      Well good idea for most casual cases, but when you need modular damage for your tanks or whatever - better to keep separated colliders on tower, tracks, hull etc.

  • @adilsonjunior5326
    @adilsonjunior5326 3 года назад

    Very good content.
    I want to create a collision mesh for a shooting game character, but I wanted to know how to make the collider detect where in the body the shot was.

  • @abultimatetanksimulator6605
    @abultimatetanksimulator6605 3 года назад

    is 1000 tris ok for the mesh, cuz if you want to do a tank game you will need to add armour values and you can t just make a cube and a sphere.

  • @jeronimocollares320
    @jeronimocollares320 3 года назад

    Let me ask you something. To a character - and im talking about a hight poly char (my toon and works fine), a low poly version can work fine like a mesh collider, IF I ONLY use it in player OR some char in the scene, no? We hav this tech today, no?

  • @offcyclops
    @offcyclops 3 года назад

    a thousand thanks to you

  • @Setsx6
    @Setsx6 2 года назад

    Can you do this in unity without using blender?

  • @ishant9423
    @ishant9423 2 года назад

    Hello, I was making a racing game and needed help regarding this
    Actually, I know there's the wheel collider component to go about it but I was planning to making my own vehicle physics
    Now, the problem I am facing is regarding the wheels collision detection. The wheels are cylindrical in shape and so I couldn't apply a convex mesh collider to them. Adding a concave collider causes them to be kinematic, which they cannot be
    Please help me out with this issue

  • @فارس-م9ش
    @فارس-م9ش 3 года назад

    Can I apply deformation on the 3D model using this optimized mesh collider way?

  • @victorlapin2080
    @victorlapin2080 3 года назад +3

    Writing on the tank means "scoundrel" in Russian 😊

    • @comp3interactive
      @comp3interactive  3 года назад +1

      Oh sweet! Atleast it wasn't offensive 😂 I never thought to check the translation!

  • @panickal
    @panickal 2 года назад +2

    Why would anyone want a tank that has no rigidbody for physics this is absurd

  • @FONORX
    @FONORX 3 года назад

    Raw Mesh Colliders - Highly likely won't affect the performance of static meshes.

  • @paulbunyangonewild7596
    @paulbunyangonewild7596 Год назад

    I see nothing here that cant be done with primitives, you know you can attach primitves to bones? That way its nice and optimized and can move, and if you really need some extra precision with placement, use a child object and rotate it, that way you can have primitive colliders at off angles, not sure if off axis scaling works (probably not because its not a great idea anyways) and all of this when attached to a parent object with a rigidbody, its gonna act like one big rigidbody. Collisions included.
    Not to mention these mesh colliders, unless broken into chunks, cannot move with animations like the graphical mesh can, itd be too expensive.
    It has to check each triangle individually for collision, and has no concept of "inside" the mesh.
    For example, a sphere collider is the simplest one, being only one 3d point in space, and then a radius in which you can collide, mesning if you somehow landed inside the mesh, it would pop you out the side youre closest too.
    Same with a box collider, it checks collisions within a box volume, and because of that, the whole box counts as colliding.
    But with mesh colliders (with maybe the exception of convex hulls, but i think theyre processed in exactly the same way, just as an easy optimization option)
    The only time you collide with the object is when you touch anywhere one the outer hull, but thats it, if something was inside, it would then be stuck in there, with the mesh collider acting like an infinitely thin wall, only colliding when it touches the edge. Its okay for more insignificant objects that are just set dressing, and if you make all your important objects collision type "Continous"(where it drags the mesh along its trajectory instead of teleporting a certain distance, which is how instantanious works)

  • @Alex-tn7pv
    @Alex-tn7pv 3 года назад

    Are you Chapter Master Valrak's brother?

    • @comp3interactive
      @comp3interactive  3 года назад +2

      I just had to check who that was, but he does sound like he's from the area I live!

  • @Jay12321Jay
    @Jay12321Jay 3 года назад

    What happens when the turret rotates...?

    • @comp3interactive
      @comp3interactive  3 года назад +2

      If you're using moving components then you'll have more than one model, so you'd make more than one collider mesh box

  • @BunnyHuggerr
    @BunnyHuggerr Год назад

    To bad ur not explaning what are you pressing for people who first time uses Blender. Like Insert Mesh and the other stuff u click on.

  • @JTAGames
    @JTAGames 3 года назад

    Cool

  • @orenhorvat1554
    @orenhorvat1554 2 года назад

    If only you'd have as little as a program telling me what the fuck to click as a shortcut or explain in detail how to extrude something because I have no way of following the tutorial without knowing exactly what to click