How to create Grenade arc using Blueprint?
Hello, I'm trying to create some sort of a Grenade launcher, but I need some sort of an indicator to showcase where the grenade will land when I fire it. Something like this (Screenshot is from the game The Evil Within)
I'm a beginner at both Scripting and Blueprint/UE4 so please keep that in mind! Thanks in advance.
asked Nov 30 '14 at 12:12 PM in Blueprint Scripting
if you want a solution that will work with arbitrary gravity and bounce prediction, you are going to need to copy all the code that alters the projectiles trajectory initially, during tick, and during a bounce, and put it in a for loop that is called by tick if the player is aiming a grenade. the loop will trace lines between points to create the arc.
inside the forLoop, any code that usually needs DeltaSeconds, should instead be given a float variable you can call DeltaSim, which is just the amount of time that passes between each point in the grenade arc. by adjusting the number of iterations of the loop, you can adjust how long the line is.
but inside the simulation for loop, instead of spawning anything, you are just copying the position to an array, then updating the simulation variables to solve for the next position. and if you hit something, you change the velocity using the same formula the projectile uses to bounce.
Follow this question
Once you sign in you will be able to subscribe for any updates here