Projectile speed increase problems
So here is my problem... i want to make my projectile speed increase the faster my character is moving, But while my character isn't moving the projectile shoots at a speed of 200 witch is what i want... but when i start moving the velocity overrides my projectile start speed and from their on out my projectile speed is 0 unless my character is moving... I want my projectile speed to always be 200 and increase as my character gets moving faster..please help!!
asked Mar 15 '15 at 11:35 PM in Blueprint Scripting
I was working on projectile inheritance last night and figured it out, hope this can help you. Everything was done in the FP_blueprint, not the projectile blueprint but the math is the same either way
The problem has to do with World Velocity and Local Velocity. With local velocity(Projectiles), X is always the direction you are facing/firing. So to add your character velocity(world velocity) to a projectile, you need to change it from World to Local by using Unrotate Vector.
Character Movement -> Velocity and Get Actor Rotation into Unrotate vector. Unrotate vector localized my velocity so that X/-X was Forward/Backwards and Y/-Y was Left/Right, I set this new vector up as a variable called Inheritance. Then it was simply Inheritance + 4000 on X Vector which I sent to Velocity in Local Space. 4000 represents muzzle velocity on X you want for the projectile.
Follow this question
Once you sign in you will be able to subscribe for any updates here