Make AI hit you with curved projectiles (Grenades, Arrows) - Unreal Engine 4

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

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

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

    how do I make the projectiles fall faster while maintaining a big curve ?

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

    I don't know how people figure stuff like this out but thanks to you; I now have perfectly accurate grenadiers in my game. Thank you!

  • @nn-ib2lt
    @nn-ib2lt Год назад

    i am sitting here hours and hours and cant figure it out. THANK YOU YOU HELPED ALOT!

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

    I was trying to do this about 3 hours, but i didnt know i think about gravity in UE which you said at the very beginning.
    You helped a lot, thanks!

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

    was trying to figure out how to convert 2d to 3d and could not figure it out whatsoever, thank you so much for making this video!!

  • @Gameplayerxyzxxx
    @Gameplayerxyzxxx 4 года назад +4

    Thank you, very useful and specific tutorial which I needed ;D

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

      Did it in c++ tough, which is a little more convenient to calculate such formulas without too much of a jungle in the code ;D

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

    This is pretty much Commander Keen Standard Galactic Alphabet (Minecraft Enchanting Table Language) to me. I'm suprised ppl actually spent that much time figuring out that equation in the first place, let alone retrofitted it to also work with 3D coordinate systems.

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

    so good math man, thank you for your tutorial, really a good improvement

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

    This helped me a lot bro, Great tutorial

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

    Thank you so much for your tutorial! I found it really helpful !! Best regards

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

    Thank you! But why is it working properly only with 2000 velocity? I can't figure out, how to adjust it to make the parabola curvy, but not high!

  • @I-VisiBomb-I
    @I-VisiBomb-I Год назад

    i get a bunch of errors after following the entire video. it says i have errors in the GetAllActorsOfClass node, and also in ForEachLoop, saying my class is not compatible or something.
    im using a character i made myself, not the one from unreal, and it works fine, but apparently theres a problem with its class? am i stupid?

  • @Abhishek-bl5vr
    @Abhishek-bl5vr Год назад

    well explained tutorial. Thank you

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

    Thanks dude!

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

    Amazing tutorial!! Really helped me

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

    Thanks so much for the video. And you could make the projectile hit a moving target?

    • @LouSimonsen
      @LouSimonsen  4 года назад +3

      Well yes, but the target location is right now just set to the target actors location and it will shoot where he stands at the moment of the calculation. You will need an expression for the actors predicted location (can be found from character speed and direction at the moment of the calculation) at the time of impact. The time of impact can be found from the output of the function (velocity and angle). But you will notice that this becomes a numerical problem since the predicted location is dependent on the time of impact which is in turn dependent on the predicted location. So you might want to approximate a linearized expression :)
      The intention of the video was just to give the formulation of a curved throw, but you will need to use it with other functions to use it properly in a game. If there's a big demand among people of how to do this I might consider making a tutorial for it.

    • @inFAMOUSgagimeister
      @inFAMOUSgagimeister 4 года назад +2

      @@LouSimonsen I would really like to see that! I demand it! no sorry just kidding... hehe, you do what you want :). But it I would find it very helpful and a great learning experience just like this one. I think your tutorials are great and I subscribed in an instant! :D

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

      other way you can do it is set an event right next to the projectile spawn that set his rotation and make a new vector based on the angles from the previous rotation of the object

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

    This is great... but is there an easier way to do this? I bet UE4 has already some simplified methods to achieve this...

    • @LouSimonsen
      @LouSimonsen  4 года назад +3

      I've been looking for an easier solution myself and this seemed like the only answer. Please notify me if you find another solution!

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

    Hello, Thank you for the tutorial, is great, it works perfect but I have one question, how can i do to make the projectile collision with the landscape ? i Try to use a capsule collision as parent of the sphere, the collision setted to overlap all, block all , I tryed all the settings and i cannot make it work, thanks

  • @ОлексійБовсуновкий

    Great tutorial, but didn`t work for some reason unless multyplied result by g/2. (Didn`t test higher angle since maximum expected is 5)

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

    This is super helpful ty

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

    Great work! Can you share project?

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

    hey,
    how can i make the projectile curve more
    would appreciate if you can reply to this asap as i have a time limit on my project
    thanks

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

      Well, this is entirely dependent on your math skills. You could isolate the equation for the velocity and set a fixed angel of, lets say 60 degrees. That would always give a high curve and then the velocity would vary?
      The easier option would be to make the equation always use the highest angel instead.

  • @mr-aydemir
    @mr-aydemir 4 года назад

    Thank you, Now My npc arrows can hit the bull's-eye.

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

    Doesn't work for me. The Projectiles spawn away from the AI that is spawning them. I am getting no height at all on the throw, more like kicked across the floor.

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

    excellent vid

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

    I made my sphere collision set to BlockAll, but sphere is goes through landscape which collision is set to BlockAll too... Why? Help pls!

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

      Perhaps you haven't set it to generate physics. Set to "Query and Physics" in collision settings. If you need some input on how to register damage and such I have just made a video on it as well: ruclips.net/video/15WNYl-YFKg/видео.html

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

      @@LouSimonsen I set to "Query and Physics" and checked all marks in collision sector to "block" in my sphere, but it doesn't care, it just goes through my hero and landscape. UE 4.26.2

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

      @@zurgsRushm Ok, do it like this:
      1. Make sure your actor only contains the projectile movement and the mesh, no "scene" components or anything else
      2. In projectile movement check "should" bounce
      3. You are done
      No need to set collision to query and physics after all :)
      The reason for step 1 is that the actor moves with the component at the top of the heirachy. If that component has no collision, such as a "scene" component, this will determine the collision. In short, the root component has to be the collision component.

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

      @@LouSimonsen Thank you very much! But now my enemy spawns grenades under him and they can't fly, grenades just trying to push enemy from the bottom :D

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

      @@LouSimonsen Is there any function like "LineTraceForObject" for this case to check if enemy can throw grenade?

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

    I have a question how can i change the projectile speed?

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

      @@LouSimonsen I tried but i couldn't. can't change the inital speed before the projectiles spawn. the inital speed I set before the game starts always remains the same. Can't we change the inital speed after a few projectiles spawn? while the game is in progress

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

      @@LouSimonsen Thank you so much man. I am
      grateful to you! i love that function :)

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

      @@ismailkucukkor141 I think he deleted his comment right?

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

      My comment disapeared when i switched to this account. To clarify the answer to this question: You should use 'Set Velocity in Local Space'. This is a vector input but it should be fairly straight forward to make it work :)

  • @thesirfm
    @thesirfm 9 месяцев назад

    you are my hero

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

    thanks a lot man this is very good, one thing tho, it seems my enemies get the shot right only when on the same plane of the player but if they're in higher or lower spot they still shoot in front of them any idea why? thank for your time

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

      The equation does account for height differnce. Check if you plugged in the z value from the actor location correctly 🤟

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

      @@LouSimonsen for me it gives me an error my aimoffset character and when i point the bow forward it's ok! he really hits the target but when i aim down he shoots up, could you help me?

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

    Could you add subtitle ,pls?

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

    how can I extend the shooting distance? (ex: AI could not shoot me if I go a bit far from it) please take response

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

      The distance you can shoot is determined by the projectile velocity i.e. higher velocity => longer distance. I mention how to change the velocity at 23:58.
      If you don't want to change the velocity of your projectile you can mess with the gravity of it instead. The gravity scale is just a factor which is multiplied by the world gravity of 980. So setting the gravity scale of your projectile to 0,8 and also multiplying the gravity in your calculation with 0,8 should give you longer distance with the same velocity. The curve will be softer though :)

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

      @@LouSimonsen Thanks for reply, actually I have really big landscape and AI enemies, when I changed the velocity it worked perfectly when they are far from me, but when they come close to me the Grenade is going crazy, flying somewhere...what do you think about this?

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

      @@Korealiklar Do they fly straight up in the air? Send me a pic of your calculation for the angle and i will check it (y)

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

      @@LouSimonsen thanks bro. Could you write your e-mail address ?

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

      @@Korealiklar I'm not showing my mail here :/ But you should be able to message me via. youtube "Go to my channel -> About -> Little Chat icon". Or you can upload a picture to imgur and post the link :)