How does projectile movement component velocity work?

Hi!

I’m trying to understand how Projectile Movement Component does it work checking the FPS template project.

One thing that I don’t understand in that component is velocity. The BP_FirstPersonProjectile has a this component which is velocity is:

What I understand is that the projectile will only move along the X-axis. So, if I shoot to the Y+ direction, I don’t understand why it continue moving on that direction, instead of changing to move on X direction.

Or maybe, if Velocity has a value on X, it implies that the projectile will move on the same direction that the character is look at. But, if it has a positive value on Y, the projectile will move to the right of where the player is look at. And, if it has a positive value on Z, it will move upwards.

Thank you!

velocity is relative to the component. if your projectile has a velocity to move to the front of your gun and you rotate the gun then next projectiles will still spawn moving front of your gun.

The PMC has 2 modes, kind of:

image

  • you either give this a value and then rotate the projectile / use velocity as direction - think of it as of local space.
  • or you leave this at 0 and provide proper velocity - in world space.

There is no difference as to how it works in the end, it’s more about convenience.

1 Like

This is what I don’t understand.

But, I’ve been testing it on the FPS Template and I’m sure how the Projectile Movement Component’s velocity moves the projectile:

if Velocity has a positive value on X, it implies that the projectile will move on the same direction that the character is look at. But, if it has a positive value on Y, the projectile will move to the right of where the player is look at. And, if it has a positive value on Z, it will move upwards.

Thank you.

it all depends on how you spawn the projectile because you have two coordinate systems: local and global. Imagine you are in a 3d space with global coordinates but you look at different directions in that space…the direction where you look can be your local Z but is a system that is independent to global coordinates (Z axis in the global system is fixed). so if you spawn you projectile with GLOBAL rotation (0,0,0) the projectile will always move in the same direction no matther where you lookin at. but if you spawn the projectile with the rotation of where you looking at then the projectile will move in the right direction because it is dependent on where you looking. the movement of the component is LOCAL. depends on how the whole actor is oriented in the world (GLOBAL) :joy:

this foundation applies to every 3d application

How can I know if the projectile has a velocity to move to the front of my gun?

Maybe, this is my problem.

Projectile velocity is the Trajectory of each axis in world space * speed.

Vector is the heading/direction.
Velocity is the heading/direction with a speed applied.

This is what I use for my projectiles.