Making a Snake shot projectile
Hello. Im wondering how i could create a projectile that moves toward the players position in a snake style moving.. I was thinking maybe adding a sine curve in the XY plane to some vector but i am not entirely sure what exactly to use. Hoping for some help with the math :)
Edit: something like this :3
A possible solution would be to move the projectile along a SplineComponent: obtain the next position to move the projectile to ( by setting the Location of the Projectile to the value returned by SplineComponent.GetLocationAtDistanceAlongSpline ) and make the projectile to face the direction of the spline ( by setting the Rotation of the Projectile to the value returned by SplineComponent.GetRotationAtDistanceAlongSpline ).
answered Sep 10 '15 at 03:38 PM
I would divide the distance from the player (ignoring the Y axis in your picture, but whatever axis it is going to be swerving along) by the distance from the player to the target. This will give you a value between 0 and 1. Sine this and you'll end up with a sine graph. You may end up having to do some manipulation of your input, but you'll at least get a sine graph that way. I think with this way you'll only get one direction of the loop.
answered Apr 05 '16 at 09:29 PM
Follow this question
Once you sign in you will be able to subscribe for any updates here