Download

Make ProjectileMovement component have random start direction

As it says in the title, I am trying to use the projectile movement component to make a ball that bounces around the level, with a random start direction. I’ve set the component to not be automatically activated, set it’s velocity variable (from blueprint) but when I click play it still has the direction from the details panel. How can this be done?

The projectilemovement component has various ways that it can be used. Are you using the homingtarget component? Perhaps you could show more detail of your setup?

There are at least 2 ways to setup your projectiles:

  • give it a speed, a 1;0;0 velocity and an initial rotation
  • give it a velocity by hand

The second case is useful if you want to calculate the velocity it needs to have when it spawns, because in this case you usually disable the projectile movement component until you gave it the right velocity (like you did).

But I think you should use the first case and let it be activated by default. You just need to random the Yaw rotation of the transform you feed in your “SpawnActorFromClass” node when spawning projectiles.

If you want more details, quote me with my name (it will generate a notification for me).

EDIT: Like so:
example.jpg