I have an AI that meele attacks you but how can i make it so that it can throw a rock at you from a distance in an arc? I so far only managed to spawn the rock on top of the enemy, now i want it to travel to the player in an arc but i don’t know how, pls help.
Ok I’ve only done this in C++ but I can guide you to what you need, first you need to calculate the hit location and assign a projectile velocity you are comfortable with, you can store that as a float on the rock if you want, to properly aim at the hit location you need to spawn the rock in a specific rotation that you can get by using SuggestProjectileVelocity, this will return a vector with the suggested velocity, get the safe normal out of this vector and you will get the desired aim direction. Now set the rock to that desired aim direction, update the projectile movement component on the rock with the launch speed and call the activate method on the projectile movement component to launch the rock. This will make the rock fly in an arc if the hit location is far enough.
You could check the source code of my project to understand how this works in C++ by clicking “here”, check the TankAimingComponent and the AProjectile classes to see this in action.
Hope this helps.
nvm its wrong XD still need help
tks for the advice i will try ^^
After doing the suggestprojectileVelocity, how do i update the projectile movement of the rock? i used set location but its not moving
i sought of manged to do it, im i doing it right?
currently im trying to use timeline to solve my issue, is that a good way of doing it?
Sorry that it too me a while to get back to you, yes you are on the right track here, just get a normal vector out of the Velocity you got back from the SuggestProjectileVelocity and that will become your aim direction, with that you get the rock, set the rotation to the aim direction, grab the movement component on the rock and set it’s launchspeed you used for the calculation back in the SuggestProjectileVelocity and now the only thing left is to call the activate method on the projectile movement component. With this your rock should fly to your desired hit location.
Tks ^^ i manged to finish what i started.
Hi there! Can you share a solution pls?