Can't change speed of projectile after spawn

Hi, so I have an actor that throws a grenade (projectile). It’s a point and click mechanic where the player clicks on a unit, then press “G” to ready grenade, then left click on a point on the ground where he wants the grenade to be thrown.

I am doing this by getting the location of the left click, and from that calculation the speed that the grenade needs to be thrown at, to arrive at the location (the angle in which the grenade is thrown is constant).

Problem is, I can’t set the initial speed of the grenade-it is at 0 as a default and it remains like that. Here is what I did, and yes I did put “Grenade speed” var on public and checked “expose on spawn”:

This is from the player controller (where I spawn the grenade):

And this is from the grenade actor itself:

Weirdly, the “print string” node at the end show that it is working as intended-the PC does provide the proper speed. But somehow the “set initial speed” node just doesn’t affect the initial speed of the actor, even though it gets correct input.

Hey @theDoron11!

So I think the issue here is that you’re setting the INITIAL speed after spawn. Begin play is not pre-spawn, and on spawn is where initial speed is called, so you’re setting it after the use. Try using the Construction script for it instead of begin play!

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.