Unreal Engine 4 Tutorial: Predictive Turrets...Shooting A Moving Target

Поделиться
HTML-код
  • Опубликовано: 15 янв 2025

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

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

    Amazing.... 4 years ago, and still the best explanation of this on YT.
    cheer, man.

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

      Glad you like it....this still useful with UE5?

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

      @@NebulaGamesInc Not sure. I'm still using UE4 for VR. But the method should work. Thing is, most people show a bunch of calculations, but figuring out how to impliment that into all the blueprint nodes is still a minefield. You cleared that, and made it look easy.
      Thanks again.

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

      Happy to hear man. Good luck with your project

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

    This is still the best tutorial for this on the internet

  • @DangerSideburns
    @DangerSideburns Год назад +2

    Old tutorial but still fantastic. Thanks!

  • @chrisfurlong4908
    @chrisfurlong4908 4 года назад +1

    Only tutorial I could find that worked!! Awesome thanks

  • @njh0183
    @njh0183 5 лет назад +3

    Hi there, this tutorial was fantastic and solved an issue many other tutorials glossed over. Thanks so much!

    • @NebulaGamesInc
      @NebulaGamesInc  5 лет назад +1

      You're welcome!

    • @r3klessgaming995
      @r3klessgaming995 5 лет назад

      @@NebulaGamesInc hi mate followed your setup but the projectiles still miss the target any ideas?

    • @NebulaGamesInc
      @NebulaGamesInc  5 лет назад

      Could be many reasons. And this method isn't a "seeking" projectile. If you want something to chase the player look into homing projectiles. This just predicts where the player should be if continuing at the same speed in the same direction. I would need to know more of your set up to tell you what the issue might be

    • @r3klessgaming995
      @r3klessgaming995 5 лет назад

      @@NebulaGamesInc i copied youre exact setup but the projectile always guesses too far in front of the player and misses if i hold the same velocity. also if i change directions the bullet misses again

    • @NebulaGamesInc
      @NebulaGamesInc  5 лет назад

      If you change direction it will miss...it has not ability to change direction once the projectile is fired. If you want that you need a homing projectile. As for it missing in front of the player must be an issue with calculating the velocity of the player. You can probably add a fudge factor to increase the distance calculation.

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

    Worked very easily! Thanks for the hard work.

  • @elocnat
    @elocnat 5 лет назад +3

    This solved my issue with my enemies not shooting directly at the player. Now I just need to add an actual turret to the truck instead of rotating the whole model. Thank you!

  • @chiefsofnobles
    @chiefsofnobles Год назад +1

    This helped so much thank you very much for making this!

  • @samsuno
    @samsuno Год назад +1

    what is the firing point used n the video? im stuck there cuz i dont know how to add it in. nvm. fuked around and found out. all good

    • @NebulaGamesInc
      @NebulaGamesInc  Год назад +1

      I forget what that dinosaur looking head was called in the engine. Sorry, search for things like "point" or something. It's basically just a placeholder item you can use for reference points when creating meshes or characters so you can do things like I did instead of having firing attached to a specific mesh it can just be a point on 3D space

  • @camronchlarson3767
    @camronchlarson3767 Год назад +1

    Finally! An explanation that doesn't take a degree in mathematics to understand lol. Many thanks my friend. I'm making a realistic space ship shooter and the ai kinda needs to be able to hit the player reliably. Lol

    • @NebulaGamesInc
      @NebulaGamesInc  Год назад +1

      ruclips.net/video/g1CCGyVoHBQ/видео.html
      Check this out, I think I have a link to a patreon page where you can download the whole project, that's as far as I got with a space shooter. Might have some hidden gems in there for you to use/ reverse engineer

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

      @@NebulaGamesInc what a legend! I'm trying to get a demo up before the end of the week for a game jam so this is greatly appreciated.

  • @finesseandstyle
    @finesseandstyle 11 месяцев назад +1

    Thanks a lot, this still works in UE5. All I wanted was the final position so to make a leading indicator for the player in a space game like in Freelancer

    • @NebulaGamesInc
      @NebulaGamesInc  11 месяцев назад +1

      Glad it is still functional all these years later. So crude though...ha

    • @finesseandstyle
      @finesseandstyle 6 месяцев назад +1

      @@NebulaGamesInc My space game has come a long way

    • @NebulaGamesInc
      @NebulaGamesInc  6 месяцев назад

      @@finesseandstyle Post a link here so we can see your progress!

    • @finesseandstyle
      @finesseandstyle 6 месяцев назад +1

      @@NebulaGamesInc it got deleted

    • @NebulaGamesInc
      @NebulaGamesInc  6 месяцев назад

      @@finesseandstyle RUclips does that sometimes. You can email me I'll post it for you if you want.

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

    This is great

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

    THANKS!!

  • @ricard_chramer
    @ricard_chramer 4 года назад +1

    Amazing, great stuff, worked first try :)

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

    great video! thanks for the help!

  • @RangePlusOne
    @RangePlusOne 4 года назад +1

    Great tutorial, helped me big time!!!!

  • @HYTEK94
    @HYTEK94 4 года назад +1

    simply genius, thank you for sharing it.

  • @ernestasuzas3273
    @ernestasuzas3273 4 года назад +1

    Very easy solution, thanks for your time :)

  • @ags9713
    @ags9713 5 лет назад +1

    thank you so much!

  • @alperyucel1348
    @alperyucel1348 5 лет назад +3

    Thank you!
    This helped me create the patroling tanks for my RTS defence game!
    Now tanks have aimbot lol, ofcourse I slowed down their rotation rate with interpolation so if something is moving too fast they are not able to hit it just like in reality

    • @NebulaGamesInc
      @NebulaGamesInc  5 лет назад +2

      Happy to help!

    • @alperyucel1348
      @alperyucel1348 5 лет назад

      @@NebulaGamesInc Well I actually didn't expected that you would respond. By the way, can you make a tutorial about making AI characters or pawns smarter? I can create a basic AI but really struggle with making them smarter, just like knowing if the player is able to see them or not so the AI won't go to an open corner and think it's hidden.
      I actually have many things to learn but can't find any valid sources, the AI is the main one for me for now.
      Thanks for the predictive turret again tho, I couldn't find it anywhere else.

    • @NebulaGamesInc
      @NebulaGamesInc  5 лет назад

      Unfortunately I have not been actively making tutorials lately as I don't have the time anymore. Also, I never really messed around with walking AI and utilizing the nav mesh and EQS system which is probably your best bet for the type of AI you want. I created AI for space games and those are a bit more complicated in the sense that nothing comes out of the box. So you have to create your own path finding and obstacle avoidance and target seeking behavior without the help of a nav mesh or EQS system to lean on. While some AI behaviors are common to all others are specific to your game and implementation. The best I can do is direct you to my patreon where you can find a free flying game template which comes with AI I created and see if any of that helps you. Good luck. Sorry can't be of more help.

    • @alperyucel1348
      @alperyucel1348 5 лет назад +1

      @@NebulaGamesInc It's alright, there is actually a flying AI pathfinder addon in marketplace for free so I'm using that pathfinder for flying AIs, it's similar to a normal Nav Mesh.
      No problem on the tutorial part tho, this video already helped me a lot and I'm thankful of that.

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

      Slowing down their ability to turn and aim is a really good idea for balance that I'm going to steal haha I'm currently making a 3D space ship shooter and the other thing I did was add a very slight randomness (about a range of 0.0001) to the Y and Z rotation of the spawned projectile to simulate the weapons having less than perfect accuracy. It makes the enemies less dangerous at long distances since the slight deviation becomes more apparent the further the projectile has to travel.

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

    When projectile is too slow this method is not accurate enough. The solution is easy: you iterate the same calculate like 3 more times, and the result will be accurate enough

  • @ripchan1413
    @ripchan1413 4 года назад +1

    hey nice video I was wondering if you could help my AI is facing the wrong way when shooting

    • @NebulaGamesInc
      @NebulaGamesInc  4 года назад

      Check the actor hierarchy, see what you're actually rotating and where the mesh is located in that hierarchy in the viewport. Could be the issue.

    • @ripchan1413
      @ripchan1413 4 года назад

      I am using a 2D sprite so instead of player ref > Tartet mesh I have Player Ref > Target Sprite but for some reason the sprite faces the opposite direction

    • @ripchan1413
      @ripchan1413 4 года назад +1

      @@NebulaGamesInc Thank you found a fix I rotated Actor in the viewport 180 on the Z

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

    Hello! How can I reduce the range? Thank you in advance for your answer!

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

    problem here is that the bullet travel time is set using the player's current location rather than the predicted location it will be traveling to.

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

      @@xk498jf It has been a while since I made this but my goal was not to actually hit the player every time. I wanted it to be able to miss if the player changed trajectory or speed so that it would appear more like a person "trying" to shoot a moving target. I could have easily calculated the exact position of the player to ensure a hit but I didn't want that.

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

    Step by step, I have implemented this tutorial but the turret is moving in random locations rather than targeting the player character. Can anybody kindly assist?

  • @GamexTRon
    @GamexTRon 4 года назад

    SetActorRotation gives errors for me "found none"

    • @NebulaGamesInc
      @NebulaGamesInc  4 года назад

      You mean "accessed none"?

    • @GamexTRon
      @GamexTRon 4 года назад

      @@NebulaGamesInc I mean "found none"

    • @NebulaGamesInc
      @NebulaGamesInc  4 года назад

      Not sure what that error is. Don't recall ever seeing it before.

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

    idfk why this is not working for me...

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

      Sorry, these things can be very difficult to troubleshoot. Sometimes it's a small detail or connection missed. Even when making the tutorials things often go wrong and I had to pause the video while I put a bunch of print strings to figure out where the code was going wrong. Programming is like that, just keep working on it I'm sure you'll find the issue. I recommend breaking the code down piece by piece make sure each step works as expected before connecting it to the next line of coding logic.

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

    My guy doesnt even spawn the bullet :D

  • @leeboi222
    @leeboi222 5 лет назад

    oy vey