Adjusting Projectile Velocity with LMB Hold
So I am working on tweaking the blueprints from the marketplace item Generic Shooter to fit my current needs, which involve holding down the left mouse button to "charge" the projectile and increase the velocity or just the initial speed of the projectile. (it's for a bow)
Currently when I fire it seems to only be taking the default speed/velocity and the projectile is simply dropping to the floor. The Fire (LMB) event is in the player character's blueprints, and after some toying around with that and the projectile blueprints, this is what I have come up with.
The idea with this version is that it counts how long the mouse button is held down, then it should multiply the amount of seconds by 500 and make that the initial speed for the projectile.
Player Character BP
I'm not quite as experienced with this engine as I'd like to be so I assume I have made a few errors in here, so any guidance would be much appreciated. Apologies if the links are a bit messy and hard to follow in the first image.
asked Feb 16 '17 at 11:39 AM in Blueprint Scripting
i think this should work, but actually i suggest you to set the initial velocity instead of the max, since it's an arrow it should start fast and fall instead getting faster while it's in the air (like a missile), i also suggest you to avoid using tick, in this case this should not be a problem but using tick may cause you to have a heavy CPU load. try the same code, but change the "initial speed" instead of the max speed and try to set the speed in the projectile's "event begin play"(so it will be set when the projectile spawn)
answered Feb 16 '17 at 12:49 PM
I would do this in a slighlt different manner. Instead of a tick, use function. Wiht LMB pressed use "set function timer by name" node - check looping and adjust the "tick" of the function. The function itself is really simple, just set velocity by multiplying previous value by 1.05 or something lower. On LMB released just pause the function.
answered Feb 16 '17 at 01:50 PM
Follow this question
Once you sign in you will be able to subscribe for any updates here