3 Unity Tricks: Gravity Wells, Right Angle Flips, and Moving Platforms

แชร์
ฝัง
  • เผยแพร่เมื่อ 28 ก.ย. 2024

ความคิดเห็น • 83

  • @git-amend
    @git-amend  2 หลายเดือนก่อน +5

    Happy Sunday! Lots of new tips and tricks today, and also I've updated the Unity Utility Library with some new hotkeys and helpers! Link in description!

    • @Fitz0fury
      @Fitz0fury 2 หลายเดือนก่อน +3

      The audacity of you to launch this the week after I implement this exact stuff! This is still super cool and I'm glad you did something like this. As is tradition I now have to know that I spent 2 weeks implementing a new thing only for you to casually write a better version of it.

    • @git-amend
      @git-amend  2 หลายเดือนก่อน

      @@Fitz0fury I think we need to sync up so I can get your timetable...

    • @Fitz0fury
      @Fitz0fury 2 หลายเดือนก่อน

      @@git-amend ill ping you later. I have made an insane amount of progress. I could actually use your advice about my next stage. The dreaded "final rework" of the battle system is coming up.

    • @Fitz0fury
      @Fitz0fury 2 หลายเดือนก่อน +1

      @@git-amend for the record silly gravity was not part of my scope. But I ended up going down a character controller rabbit hole for a few weeks ..all because I had started causing some conflicts between old code where i was handling interactions without using an interactable interface and an asset I use for its inventory database.

  • @PsigenVision
    @PsigenVision 2 หลายเดือนก่อน +4

    I have never clicked a video so fast. This is PRECISELY the hurdle my game is focusing on right now with the Gravitas asset-creator.
    Lol I say this before even proceeding with the video because that is how much I trust git-amend. XD

    • @git-amend
      @git-amend  2 หลายเดือนก่อน +2

      Lol well I hope it helps you out! Though I think this is a bit different than the Gravitas asset, though I’m not really familiar with it.

    • @PsigenVision
      @PsigenVision 2 หลายเดือนก่อน

      @@git-amend You might be right XD I might have let my excitement take over a little bit back there. 😅 STILL related though! I'm excited!

  • @kpm25
    @kpm25 2 หลายเดือนก่อน +1

    Hi Adam, maybe you could do a video one day on your recommended most-needed/useful assets to buy?? For example, I am wondering if I should purchase Odin Inspector , and the importance of doing so..... cheers

    • @git-amend
      @git-amend  2 หลายเดือนก่อน +1

      That is actually the subject of next week's video!

  • @profzeta8598
    @profzeta8598 2 หลายเดือนก่อน +2

    you could add a script that takes any moving platform velocity and adds it to the character controller as additional force. as conservation of momentum.
    i.e you jump from one train car to another train car. without suddenly being de-parented or float off the moving platform.

    • @git-amend
      @git-amend  2 หลายเดือนก่อน

      I like that idea! Will play around with that later, cheers!

  • @Antony14021894
    @Antony14021894 2 หลายเดือนก่อน +1

    Great video as usual!
    What happens if you jump while in the gravity well and are upside down?

    • @git-amend
      @git-amend  2 หลายเดือนก่อน +1

      Thanks! If you jump in the well, you'll get pulled in the downward direction of the player - that's a function of the player controller script though, which we'll get into in an upcoming video. You can see it on my Twitter feed here: x.com/AdamMyhre1/status/1814878970409824446

    • @Antony14021894
      @Antony14021894 2 หลายเดือนก่อน

      @@git-amend Great, thanks!

  • @celtican1622
    @celtican1622 2 หลายเดือนก่อน

    What are your thoughts on tweening libraries (i.e. DOTween)? I'm a bit surprised that I haven't seen you use DOTween in your videos yet. You'd be able to rewrite the moving platform script to be *much* smaller and easier to read (albeit with a small performance hit, naturally).

    • @git-amend
      @git-amend  2 หลายเดือนก่อน

      Actually I've really been getting into PrimeTween lately for it's ease of use and zero allocations;, I've all but retired DOTween. As far as using it for Platforms, of course that's a great solution as well. Maybe I'll show an updated version when we get to the video about the Controller in a few weeks.

    • @celtican1622
      @celtican1622 2 หลายเดือนก่อน

      @@git-amend Oh I haven't heard of PrimeTween. Thanks for the rec!

  • @WelshGuitarDude
    @WelshGuitarDude 2 หลายเดือนก่อน

    Could you do a video on how to make own our navmesh system? Unity's is lacklustre and the asset store options are great but are quite overkill. I would love to learn to make my own but it seems very advanced and complicated especially run time stuff.

  • @Thomas-yz3ny
    @Thomas-yz3ny 2 หลายเดือนก่อน

    Danke!

    • @git-amend
      @git-amend  2 หลายเดือนก่อน +1

      Thanks for the super!

  • @techdave99
    @techdave99 2 หลายเดือนก่อน +1

    Hope the move goes well and the flight is on time.

    • @git-amend
      @git-amend  2 หลายเดือนก่อน

      Me too! Thanks! I'm all set to go.

  • @rofu8096
    @rofu8096 2 หลายเดือนก่อน +1

    Can you make a fps game I really need a good tutorial

    • @git-amend
      @git-amend  2 หลายเดือนก่อน +1

      Maybe one of these days, though to be honest I think not many people ask for that because there are so many videos about FPS on TH-cam already. Is there something in particular about FPS that you think I could talk about that nobody else has covered before?

    • @rofu8096
      @rofu8096 2 หลายเดือนก่อน

      @@git-amend As you said, there may be many resources on the internet, but I am really curious about your approach.

  • @joe72110
    @joe72110 17 วันที่ผ่านมา

    Hello, Thank you so much for these Videos... I am very new to Unity and I have learned so much already thank to your channel. I was wondering if there was a place where you were publishing the entire project (Assets included)?

    • @git-amend
      @git-amend  17 วันที่ผ่านมา

      Thanks for watching! A link to the code (which is free when available) will be in the video description. There will also be links to most Assets used, which is usually a mix of free and paid Assets from the Unity Asset Store. Because most videos use paid Assets, there will rarely be a complete project for you to download.

  • @forbiddenbox
    @forbiddenbox 2 หลายเดือนก่อน +1

    SUNDAY

    • @git-amend
      @git-amend  2 หลายเดือนก่อน

      You know it!

  • @techdave99
    @techdave99 2 หลายเดือนก่อน +1

    This is a great video. I'm working on a character controller and might use this. Still working out if I want a rigidbody or not.

    • @git-amend
      @git-amend  2 หลายเดือนก่อน +1

      Nice. I usually find that it's more useful to have one, but I almost always take full control of it. The main reason is so I can have collisions without requiring rigidbodies on all the other objects.

  • @6Abdellah9
    @6Abdellah9 2 หลายเดือนก่อน

    amazing video as always. can i ask for a future video fro you to make sone sort of loadout system were you could have a gun for example and pick between attachments and this is updated at runtime and is saved too as I know with scriptable objects they cannot be changed at runtime. i have tried making a system but it just doesn't feel good I'm hoping you have an amazing solution as always

    • @git-amend
      @git-amend  2 หลายเดือนก่อน

      Thanks! That's not a bad idea, I'll jot that one down!

  • @VladaPersonal
    @VladaPersonal 2 หลายเดือนก่อน +1

    Keep going, great work!❤

    • @git-amend
      @git-amend  2 หลายเดือนก่อน

      Thank you!

  • @folkenberger
    @folkenberger 2 หลายเดือนก่อน

    You could also use the improvisedTimers you did before to create custom fixedupdate that also follow the same workflow you did in here, as well to be able to turn the "updating" off when we know its in no use.
    Would that be a thing worth doing? that way the coroutine wouldnt be playing at all times

    • @git-amend
      @git-amend  2 หลายเดือนก่อน +1

      You could do that yes, but it might introduce another level of complexity that - in this case at least - is not necessary since a MonoBehaviour / Coroutine combination already provides all the functionality that we need. If you needed to make some kind of more complex platforms, you could consider doing that. Just remember the extra complexity has to be justifiable, so always ask yourself what problem you need to actually solve that requires the more difficult solution.

    • @folkenberger
      @folkenberger 2 หลายเดือนก่อน

      @@git-amend Appreciate the reply, i really didnt considered the complexity being an issue, since the way i thought about it is that after being used to work with them, it wouldnt be that hard to do.
      Keep the good work!

  • @dhawaljhaveri7615
    @dhawaljhaveri7615 หลายเดือนก่อน

    Great video. This one helped me with one of the issues I was facing. Is there a way to alter gravity with arrow keys so that we can flip the player gravity in any of the directions(Up, Left Right, Down) and allow normal movements on those surfaces?

    • @git-amend
      @git-amend  หลายเดือนก่อน

      Thanks! I think if you want to do that you need to disable gravity of course on the rigidbody and then start applying your own force in a particular direction, usually coming from the player's transform.position.up direction. We're actually going to look at that a bit this weekend.

    • @dhawaljhaveri7615
      @dhawaljhaveri7615 หลายเดือนก่อน

      @@git-amend thanks for the tip, I'll look forward to this week's video. I tried doing the gravity manipulation with Vector3.up / left / right and so on which was a success but the player movement gets messed up in turn.

  • @anasmostefaoui3027
    @anasmostefaoui3027 หลายเดือนก่อน +1

    These are the kind of video on topics that you usually spend hours trying to figure out how to do, thanks a lot.
    An suggestion for future video is the vector math used in the gravity well. I remember it gave me hard time to build up a mental modal to assimilate the math. With your teaching style, It can be amazing!

    • @git-amend
      @git-amend  หลายเดือนก่อน

      Good idea, a few others have asked about Vector Math as well. Cheers!

    • @anasmostefaoui3027
      @anasmostefaoui3027 หลายเดือนก่อน

      @@git-amend it will be awesome to have an extended version of it as paid content!

  • @vakuzar
    @vakuzar หลายเดือนก่อน

    How does this handle curves. Like if the walla had a minor bend to them, what if it was on a sphere, or just in general if that gravity well wasn't a perfect circle?

    • @git-amend
      @git-amend  หลายเดือนก่อน +1

      It's dependent on the center point to correctly determine where UP is. So, if you want to handle curves, then my suggestion is to use DOWN instead and make the normal of the curve the direction to align with, which will take a small extra calculation. With the outside of a sphere, you could just use the center point in that case but reverse the direction.

    • @vakuzar
      @vakuzar หลายเดือนก่อน +1

      @@git-amend I think you should consider adding a Möbius strip to your edge cases for character controllers that defy gravity. I think that's got to be the ultimate edge case (and will look awesome)

  • @-moristan109
    @-moristan109 2 หลายเดือนก่อน

    16:24 the great for optimization that won't generates alote of garbage only create the instances once

    • @git-amend
      @git-amend  2 หลายเดือนก่อน +1

      Yup, and I've now added that to the Utils library too for future use!

    • @-moristan109
      @-moristan109 2 หลายเดือนก่อน +1

      @@git-amend great keep up the good work your content is the best out there

  • @UTTheLaw
    @UTTheLaw 2 หลายเดือนก่อน

    Great work! Keep it up!

    • @git-amend
      @git-amend  2 หลายเดือนก่อน

      Thanks, will do!

  • @yours_indie_game_dev
    @yours_indie_game_dev หลายเดือนก่อน

    can you do how to create a motion matching system tutorial

    • @git-amend
      @git-amend  หลายเดือนก่อน

      Well, I do love motion matching, but I think a video about how to make a system from scratch is beyond what I have time to make. Maybe a video explaining how to use an existing tool, or the principles of motion matching. I'll give it some thought.

    • @yours_indie_game_dev
      @yours_indie_game_dev หลายเดือนก่อน

      @@git-amend that wuld be fine

  • @jamestanubrata6782
    @jamestanubrata6782 2 หลายเดือนก่อน

    That's so cool

    • @git-amend
      @git-amend  2 หลายเดือนก่อน

      Thanks!

  • @uhhmir
    @uhhmir 2 หลายเดือนก่อน +1

    cant wait for a character controller episode!

    • @git-amend
      @git-amend  2 หลายเดือนก่อน +1

      Coming soon!

    • @lordfrazao1026
      @lordfrazao1026 2 หลายเดือนก่อน

      @@git-amend Awesome, I hope it's third person controller with rigibody!

  • @damonfedorick
    @damonfedorick 2 หลายเดือนก่อน

    Nice

    • @git-amend
      @git-amend  2 หลายเดือนก่อน

      Thanks

  • @정동우-n2x
    @정동우-n2x 2 หลายเดือนก่อน

    It really helped me.

    • @git-amend
      @git-amend  2 หลายเดือนก่อน +1

      Glad to hear it!

    • @정동우-n2x
      @정동우-n2x 2 หลายเดือนก่อน

      @@git-amend always Thanks! Teacher

  • @drewalkemade3715
    @drewalkemade3715 2 หลายเดือนก่อน

    Great video. Really fun mechanics here, I will be trying them out today. Also I like that addition to the utility library, after you mentioned that you don't like the new command in coroutines that got me thinking about that as well, I had not considered that a possible issue before, and the WaitFor feels cleaner. Looking forward to the advanced character controller. Thanks git!

    • @git-amend
      @git-amend  2 หลายเดือนก่อน

      Sounds good! Thanks for the comment! I agree, the WaitFor is definitely cleaner.

  • @Betruet
    @Betruet 2 หลายเดือนก่อน

    What a fantastic video, so well explained and executed. thanks for the lesson!

    • @git-amend
      @git-amend  2 หลายเดือนก่อน

      You're very welcome!

  • @Ironlionm4n
    @Ironlionm4n 2 หลายเดือนก่อน

    Amazing stuff as always Git-Amend 🤝

    • @git-amend
      @git-amend  2 หลายเดือนก่อน +1

      Much appreciated

  • @MrOmega-cz9yo
    @MrOmega-cz9yo 2 หลายเดือนก่อน

    Hi, just wondering about a few things. most tutorials I've seen just parent an object to a platform, which you mention in the video. Any reason you didn't do that? Is the code more efficient, or just a choice? Also, to run around on a sphere, could you just reverse the gravity well up, or would there be more to it?

    • @uhhmir
      @uhhmir 2 หลายเดือนก่อน +2

      First reason I could think of is that is that the player risks getting unloaded/destroyed along with its parent platform. It also copies the platform's rotation and scale to the player, which you might not want

    • @git-amend
      @git-amend  2 หลายเดือนก่อน +1

      The main issue with the reparenting are the issues that @uhhmir mentioned, and beyond that, it may be more reusable and modular in that it can be adapted to various moving platforms and objects without worrying about the parent-child relationship.
      And, yes you can certainly do similar calculations to figure out the correct up direction on a globe - essentially the player's up direction will just need to be inverted.

    • @MrOmega-cz9yo
      @MrOmega-cz9yo 2 หลายเดือนก่อน

      @@git-amend 👍

  • @fleity
    @fleity 2 หลายเดือนก่อน

    Interesting, I would have expected that the gravity well component could basically have handled the right angle flip situation as well. It probably can when we change the center calculation to instead use a plane projection for direction. But the way you showed is simpler.
    Looking forward to the player controller video(s). I always struggle with those.
    Do you know why is the new waitforfixed update not static to begin with? I always thought the amount of time to wait might not be the same between frames or sth like that.

    • @git-amend
      @git-amend  2 หลายเดือนก่อน +1

      Thanks for the comment, and the excellent question. WaitForFixedUpdate can't be a static class because to be used as a yield instruction in Unity, a class needs to implement the IEnumerator interface. This interface requires instance methods such as MoveNext, Reset, and a property Current. A static class cannot provide these instance methods because it cannot be instantiated. So, the next best thing would be to instantiate a new one and cache it.

    • @fleity
      @fleity 2 หลายเดือนก่อน

      @@git-amend Ah okay, makes sense, but let me rephrase. WaitForSeconds is difficult to re-use because the amount of time passed in changes we need new instances here, makes sense. But if the instances of WaitForFixedUpdate and WaitForEndOfFrame can be re-used across different coroutines I wonder why didn't unity already create instances of those automatically with sth. like initialize on load or similar (and make those accessable through a static class, the way you did).

    • @git-amend
      @git-amend  2 หลายเดือนก่อน +1

      @@fleity That's a tough one, but given Unity's penchant for leaving things up to the developers, I think they would tell you that it is to provide the flexibility to control instantiation and lifecycle management explicitly. For example, you might want to add some kind of debug hook to the yield instruction instance (or it's usage). Of course, they've never really explained that one, so I'm just making a guess.

  • @ducnguyenzz
    @ducnguyenzz 2 หลายเดือนก่อน

    nice

    • @git-amend
      @git-amend  2 หลายเดือนก่อน

      Thank you!