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.
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?
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.
@@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
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
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
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.
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.
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
@@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
@@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.
@@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
@@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
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 :)
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 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?
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 :)
@@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?
@@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 :)
how do I make the projectiles fall faster while maintaining a big curve ?
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!
i am sitting here hours and hours and cant figure it out. THANK YOU YOU HELPED ALOT!
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!
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!!
Thank you, very useful and specific tutorial which I needed ;D
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
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.
so good math man, thank you for your tutorial, really a good improvement
This helped me a lot bro, Great tutorial
Thank you so much for your tutorial! I found it really helpful !! Best regards
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 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?
well explained tutorial. Thank you
Thanks dude!
Amazing tutorial!! Really helped me
Thanks so much for the video. And you could make the projectile hit a moving target?
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.
@@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
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
This is great... but is there an easier way to do this? I bet UE4 has already some simplified methods to achieve this...
I've been looking for an easier solution myself and this seemed like the only answer. Please notify me if you find another solution!
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)
This is super helpful ty
Great work! Can you share project?
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
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.
Thank you, Now My npc arrows can hit the bull's-eye.
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.
excellent vid
I made my sphere collision set to BlockAll, but sphere is goes through landscape which collision is set to BlockAll too... Why? Help pls!
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
@@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
@@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.
@@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
@@LouSimonsen Is there any function like "LineTraceForObject" for this case to check if enemy can throw grenade?
I have a question how can i change the projectile speed?
@@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
@@LouSimonsen Thank you so much man. I am
grateful to you! i love that function :)
@@ismailkucukkor141 I think he deleted his comment right?
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 :)
you are my hero
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
The equation does account for height differnce. Check if you plugged in the z value from the actor location correctly 🤟
@@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?
Could you add subtitle ,pls?
how can I extend the shooting distance? (ex: AI could not shoot me if I go a bit far from it) please take response
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 :)
@@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?
@@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)
@@LouSimonsen thanks bro. Could you write your e-mail address ?
@@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 :)