Modifying speed of ProjectileMovement component after spawn

swolf
Mon, 27 Nov 2017 21:04:00 +0000
World Creation

Is it possible to modify the InitialSpeed (or otherwise make it move) after a ProjectileMovement component comes into existence in the game?

My project has a projectile (an arrow), that exists in the world before its “fired”, and I want the speed at which it travels to be variable on how far back the player draws the bow. If i set the “Initial Speed” variable in the ProjectileMovement component’s default settings, it flies off just fine (the component has auto-activate disabled, and I trigger it at the right time with an Activate node), so I am pretty sure everything as far as the arrow actor, as a projectile, actually works.

However! I want to modulate the speed of the arrow. So, I’m setting “initial speed” to be whatever the desired speed is (I’ve confirmed the value i’m feeding it is, in fact, good and correct) and then activating the component; this is where my problem is. It seems that it ignores any value set via blueprint, and going with whatever the default value is. Leaving the default at 0 just causes the arrow to unceremoniously drop to the ground, ignoring whatever value I set via blueprint.

I’ve also tried to create a ProjectileMovement component on demand, but it seems to behave in the exact same way. Perhaps it only cares about “Initial Speed” the moment the component comes into existence and setting it after is meaningless?

Has anyone else got the ProjectileMovement component to work with a variable speed after it already exists in the world? Or is there any other way to change the velocity of a ProjectileMovement component after it’s come into existance?

7 posts - 4 participants