How to Inspect Items and Objects! (Rotate around 3D Mesh, Inventory, Unity Tutorial)

Поделиться
HTML-код
  • Опубликовано: 21 сен 2024
  • ✅ Get the Project files and Utilities at unitycodemonke...
    🌍 Get my Complete Courses! ✅ unitycodemonke...
    👍 Learn to make awesome games step-by-step from start to finish.
    🎮 Get my Steam Games unitycodemonke...
    🔴 RELATED VIDEOS 🔴
    Make Awesome Effects with RenderTextures! (Minimap, In-game TV, Camera to Texture) • Make Awesome Effects w...
    Awesome Inventory Tetris System! (Resident Evil 4, Escape from Tarkov) • Awesome Inventory Tetr...
    Simple Inventory System in Unity (Store, Use, Stack and Drop Items) • Simple Inventory Syste...
    How to Equip Weapons and Items in Unity (Drag Drop, Inventory) • How to Equip Weapons a...
    Make your Games Designer Friendly! (Scriptable Objects) • What are Scriptable Ob...
    💬 Let's make an Item Inspect System!
    This is the kind of thing you see in many games where you have some sort of inventory and you have a separate view to look at the object's 3D mesh, you can rotate around and look at it from any angle.
    It's relatively easy to do and adds a nice extra bonus to your Inventory System.
    🌍 Get Code Monkey on Steam!
    👍 Interactive Tutorials, Complete Games and More!
    ✅ store.steampow...
    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
    🎮 Grab the Game Bundle at unitycodemonke...
    📝 Get the Code Monkey Utilities at unitycodemonke...
    #unitytutorial #unity3d #gamedev
    --------------------------------------------------------------------
    Hello and Welcome!
    I'm your Code Monkey and here you will learn everything about Game Development in Unity using C#.
    I've been developing games for several years with 8 published games on Steam and now I'm sharing my knowledge to help you on your own game development journey.
    I do Unity Tutorials on just about every topic, Unity Tutorials for Beginners and Unity Tutorials for Advanced users.
    You can see my games at www.endlessloopstudios.com
    --------------------------------------------------------------------
    - Other great Unity channels:
    Unity - / unity3d
    Brackeys - / brackeys
    Dani - / @danidev
    Jabrils - / @jabrils
    BlackthornProd - / @blackthornprod
    Sykoo - / sykootv
    Jason Weimann - / @unity3dcollege
    Jonas Tyroller - / @jonastyroller
    --------------------------------------------------------------------
    - Website: unitycodemonke...
    - Twitter: / unitycodemonkey
    - Steam: store.steampow...

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

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

    ✅ Get the Project Files unitycodemonkey.com/video.php?v=tJ_ycboPFmY
    🌍 Get my Complete Courses! ✅ unitycodemonkey.com/courses
    👍 Get 3000+ AWESOME Assets at 96% OFF! www.humblebundle.com/software/best-polygon-game-dev-assets-software?partner=codemonkey
    🔴 RELATED VIDEOS 🔴
    Make Awesome Effects with RenderTextures! (Minimap, In-game TV, Camera to Texture) ruclips.net/video/Ah2862Gz3_s/видео.html
    Awesome Inventory Tetris System! (Resident Evil 4, Escape from Tarkov) ruclips.net/video/fxaDBE71UHA/видео.html
    Simple Inventory System in Unity (Store, Use, Stack and Drop Items) ruclips.net/video/2WnAOV7nHW0/видео.html
    How to Equip Weapons and Items in Unity (Drag Drop, Inventory) ruclips.net/video/isAmoM3RPEI/видео.html
    Make your Games Designer Friendly! (Scriptable Objects) ruclips.net/video/7jxS8HIny3Q/видео.html

  • @stylie473joker5
    @stylie473joker5 2 года назад +9

    You have no idea how much i needed this i looked other tutorials but they're complicated and don't explain well thank you soo much

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

    I am beginning to think CM is looking at my search history because I was JUST looking for a good tutorial on 3d item inspection this morning. 😂 Thanks so much Code Monkey! :D

  • @NoTimeLeft_
    @NoTimeLeft_ Год назад +5

    For anyone using this method, please be aware of Gimbal Lock.
    When rotating using Eulers instead of Quaternions you run into a situation where two axis can 'collide' and you lose a degree of freedom. This is what happens when I implement the code seen in this video.
    The reason is a bit long (you can have multiple incorrect axis rotations for the same desired rotation) but because Quaternions use 4 values to determine rotation you don't run into this issue.

  • @davidwusoftdev
    @davidwusoftdev 2 года назад +5

    An important thing I would like to point out is to remember to unsubscribe from the event, to avoid memory leaks. It could be done in the OnDestroy method.

  • @Killerkraft975
    @Killerkraft975 4 месяца назад

    Omg thank you so much. I didn’t know how to describe this kind of rotation and I couldnt find any material on rotating an object using the mouse.

  • @smallg9109
    @smallg9109 2 года назад +18

    would be a good addition to mention that moving the inventory objects and camera to a different layer is worth it for performance reasons as cameras get very performance heavy quickly and it'll stop any unwanted objects from blocking / showing up in the inventory camera

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

      And then you don't have to move the camera/object really far away. This can be useful if you want to define deltas too, like zooming out the camera or panning the object around.

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

    I just found your channel recently and i am baffled, not just because your videos are great but that is so satisfying to me how you arange your code. I mean i can read code and follow a tutorial without problems if the brackets are not there where i would place them, but it is so fucking awesome if you find a tutorial that aranges the code the same way you did. I have no words how great this is and how happy i am with that. Thank you very much!

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

    Render Texture is becoming as powerful as the Unity's Particle System. Very cool.

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

    Very nice implementation! Also, don't forget to unsubscribe from events to prevent memory leaks.

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

    I always wanted to know how that actually works thanks
    awesome tutorial

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

    LOVE IT! one more step to custom characters!

  • @CarlosMagno-hp2bo
    @CarlosMagno-hp2bo 2 года назад

    Very top Code Monkey, your tutorials
    help a lot. Congratulations

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

    I think instead of destroy the game object .. set active and and deactivate is a a less processing idea

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

      Yes, but also, we are on a paused game, so when unpausing you can manually call to clean the garbage collector, so your instanced objects will affect nothing on your game.

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

    One suggestion… it seems no one makes tutorial content with gamepads in mind. For me I have no interest in only doing desktop games (because I never play desktop games). Also I can’t find much/any content on navigating UI with gamepads and the new input system.

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

      That’s two suggestions (maybe) for content. Btw, love your work, will have to get your latest course soon. (Even though so haven’t finished the Bolt one yet)👍🏻

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

      Unity has a built-in Navigation menu for the UI, although I haven't used it much. In the only game I did where I supported gamepad UI I built everything myself
      Something I would like to one day explore would be a virtual cursor, kind of like Destiny

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

    Useful and fun. Nice job !

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

    Never thought of that way on creating this! Is like I said you really are a legend!
    Btw! I already did your character in-game! And mannn, it looks like you hahah
    Is there any way I can show you? E-mail/twitter?
    Thank you once again!

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

      Sure you can post the image on twitter @UnityCodeMonkey

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

      @@CodeMonkeyUnity Thank you! I did it! Once again! Thank You!😃

  • @eduardorpg64
    @eduardorpg64 19 дней назад

    What version of Unity are you using in this video?

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

    I hope that one day you will create a course to make a simple multilayer card game, somehow I can not find anywhere such a series on yt, which some creators have started are usually abandoned, knowing your skills I'm sure you would be able to create such a course, when it would happen I would love to buy it as well as your other courses. I know that this is a very extensive topic even for such a small project, so I understand why it is so hard to find such courses, but it is a great loss for fans of the genre.

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

      For multiplayer, I'm still waiting for the official Unity multiplayer to come out of beta.

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

    Nice Tutorial, I want to adjust "orthographic.size = any 3d mesh Fit size", can you help me with this please?

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

      You could check the renderer bounds then do some math depending on the distance of the camera and adjust the fov or move the camera
      Remember that orthographic size is only used in 2D cameras, not 3D

  • @codeshelldev
    @codeshelldev Месяц назад

    Hi CodeMonkey, I was wondering how I could implement this like Minecraft, which renders blocks as isometric icons, but I have a concern: Too many Cameras is no good for Performance.
    Is there maybe another way to do this?
    Thanks, love your videos!

    • @CodeMonkeyUnity
      @CodeMonkeyUnity  Месяц назад

      You can lower the resolution of the camera
      Although how many items are you showing? Ideally you should only inspect 1 or 2 items. Adding the ability to inspect a dozen items at once is going to be quite costly no matter what.

    • @codeshelldev
      @codeshelldev Месяц назад

      @@CodeMonkeyUnity Thanks for you answer, I was planning on having 16 rendertexture (wich is way too much), I don‘t need to inspect the items, they could also be static but the thing is that I cannot use an image.
      I just searched for the closest video to my problem.

  • @DavidRodriguez-jr6fd
    @DavidRodriguez-jr6fd 2 года назад +1

    if you wanted to have items that you can also interact with, like opening a box in the resident evil games, could you do it also with the event handlers in the same script (and maybe a ray traced from that camera)? Or it wouldn't be possible because you are using a rendertexture? In that case, would there be a way or would it be better to redo it without a render texture?

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

      The tricky part would be identifying where you are grabbing. You do have more pointer data in that event to check the position which you could use for that logic but it would be tricky.
      Handling that logic by interacting with the object itself, instead of through a render texture, would be much simpler. Just a raycast on mouse click, separate the box top from the box bottom and see where the player is clicking.

    • @DavidRodriguez-jr6fd
      @DavidRodriguez-jr6fd 2 года назад

      @@CodeMonkeyUnity Maybe a good mix then would be to do like another comment mentioned, and just keep the item cam and model in separated layers so you don't need to hide them in a corner and can just show the mesh itself. I imagine having the rotation working then would need different code? or would those events be available even if just clicking on a model? Thanks for the help!

    • @DavidRodriguez-jr6fd
      @DavidRodriguez-jr6fd 2 года назад

      @@CodeMonkeyUnity After a long time of trying and testing different ways to do this... I wasn't able lol. Any chance that you'd make a second video with an item inspection where you can actually also click on parts of the item to open a case or remove a jewel or whatnot, RE style?

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

    what is line 19 in DummyInventory?

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

    How can i handle when the object is so big

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

    10/10

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

    It doesn't work for me in the project I want to use it(use the rotation on drag in that project I mean), in other projects yes but not in this one. Could be that it's because of being a FPS and using the main camera for the "camera look"(using the cursor as main point of the camera). But I tried many things and I haven't been able to fix it.
    Edit: My bad, I saw now that my EventSystem didn't exist. That's why the object didn't rotate.

  • @FaberDM
    @FaberDM 2 месяца назад

    Hello. I've installed URP and all packages suggested but the class Light2D is still unrecognizable, even by renaming the namespaces :( I'm using Unity 2022.3.22f1 Thanks

    • @CodeMonkeyUnity
      @CodeMonkeyUnity  2 месяца назад

      What using statement do you have? That class exists inside UnityEngine.Rendering.Universal

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

    Neat!

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

    that's a cool mechanic to use in inventory but is there any way to set animation evry time the item change? like small swap or big cyckle effect?

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

      You mean show multiple meshes at once? Sure, instead of deleting the last one instantly you could always keep the last two alive, then make a quick animation moving the previous mesh to the left side, spawning the next one on the right and moving it to the center. Just some basic animation with 2 objects

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

      @@CodeMonkeyUnity thanks

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

    Guys, please tell where can i read about syntax that used here 4:20 at line 10. Cause I dont even know what i need to ask in Google)

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

      That's subscribing to an event, so when that event is triggered that function will be called.
      I covered events in detail here ruclips.net/video/OuZrhykVytg/видео.html

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

      @@CodeMonkeyUnity Many thanks!

  • @mrzaphkielYT
    @mrzaphkielYT 2 месяца назад

    How can you Instantiate a GameObject into a Transform?

    • @CodeMonkeyUnity
      @CodeMonkeyUnity  2 месяца назад

      If you call Instantiate(); and you pass in a Transform it will return a transform, if you pass in a GameObject it returns a gameObject. ruclips.net/video/B-dVf9wUEbg/видео.html

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

    This doesn't work for different screen resolutions. How do you make sure the item stays center frame for the camera since its in world space?

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

      What doesn't work in different resolutions?
      In the demo I just scaled all the preview objects to fit roughly the same size.
      Alternatively you could get the mesh render bounds and do some math to set the cameras FOV/Distance

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

      @@CodeMonkeyUnity if the resolution of the screen changes, such as doing it in the editor or on a test device, the item doesn't appear in the frame, unless i missed some setting u used to stop that

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

    Could someone point in the direction of how to make 3d images in to 2d sprites like on the buttons?

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

      I just took a screenshot, pasted it in photoshop and cropped the background. If you want to make it automatic you can make some screenshot and file save code
      unitycodemonkey.com/video.php?v=d5nENoQN4Tw
      unitycodemonkey.com/video.php?v=dqySkMFieHE

  • @林夜明-x1t
    @林夜明-x1t 2 года назад

    Mr. Monkey would like to ask that many of your game source packages have a 2D animation system called V_Animation. I don’t know if it is a plug-in or a tool written by you. If it is a tool written by yourself, where can I learn it? It is very important to me. thanks

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

      It's my custom animation system based on dynamically modifying meshes ruclips.net/video/11c9rWRotJ8/видео.html

    • @林夜明-x1t
      @林夜明-x1t 2 года назад

      @@CodeMonkeyUnity love you love love you

    • @林夜明-x1t
      @林夜明-x1t 2 года назад

      In addition, may I ask the teacher, have you successfully combined this animation system with Unity's dots system? I feel like this is a huge technological breakthrough

  • @eduardorpg64
    @eduardorpg64 18 дней назад

    Don't fast forward when you're writing the code. It makes it harder to follow and understand.

    • @CodeMonkeyUnity
      @CodeMonkeyUnity  17 дней назад

      You can pause the video or download the project files linked in the description

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

    IDragHandler is not respoding

  • @SonuKumar-js5wv
    @SonuKumar-js5wv 2 года назад +1

    Unity was not crashing sir , build game is not launching , its created for Mobiles , and checking it on mobile and not starting !!

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

    Wait some 2D features

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

    Now do it with HDRP...

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

    active ragdoll unity3d pls

  • @SonuKumar-js5wv
    @SonuKumar-js5wv 2 года назад

    It is tecnical issue help me out please !!!

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

    Great video as always!
    But If you still experience some buggy behavior while dragging the item around, try this:
    if (Vector3.Dot(Youritem.transform.up, Vector3.up) >= 0)
    {
    Youritem.transform.eulerAngles += new Vector3(-eventData.delta.y, -eventData.delta.x, 0);
    }
    else
    {
    Youritem.transform.eulerAngles += new Vector3(eventData.delta.y, eventData.delta.x, 0);
    }
    And I also have found another issue, There is a really nasty seam around the rendered object inside the renderTexture, and turning on Anti-aliasing does not seem to help.
    Does anyone else have the same issue?

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

      public void ClearOutRenderTexture(RenderTexture renderTexture)
      {
      RenderTexture rt = RenderTexture.active;
      RenderTexture.active = renderTexture;
      GL.Clear(true, true, Color.clear);
      RenderTexture.active = rt;
      }

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

      thank you so much...