How to set ProjectileMovementComponent?

Hi! For the last couple of days I’m trying to install UProjectileMovementComponent for an object of the AActor type. Everything happens in a ACharacter player function. The player sees the object (AActor type), get it, throws it.
In the documentation of the required function I did not find, getting the root component and installing through SetUpdateComponent not help.

Of course I’m sure that this is not the best approach (and maybe impossible), but I do as I thought out. And, yes, i newbie.

For answer of Jawdi:

On the tutorial in the documents, I understood how to create what you described. But the snag is that: 1. The object does not spawn several times but only one, i.e. I work with the same instance throughout the game. 2. If you install a projectilemovement in the object class, then when you start the game, it flies away. That’s why I’m trying to install a projectilemovement for a getting object (which has a minimum collision). The logic is this: I get the object, trow it (set the projectilemovement for it, and the velocity with the direction). The object does not disappear. Like a simple ball game.
So I’m trying to get or a collision of the object, and install through the ACharacter class projectilemovement in the function of the throw. Or get the projectilemovement itself, written beforehand in the object’s constructor (only creation, without setting speed parameters, etc.). And already in the function of the throw ACharacter to establish for him the speed, direction, etc.
Maybe my idea is a bit complicated, or even impossible. So if there is another way please write.

Have you created your own class that extends AActor?
Let’s call this custom class AProjectileActor.

In the header (.h) file, you’ll need to declare a Component. Something like:

/** Projectile movement component */
UPROPERTY( VisibleAnywhere, BlueprintReadOnly, Category = "Your Category", meta = ( AllowPrivateAccess = "true" ) )
UProjectileMovementComponent*			ProjectileMovement;

And then in the implementation (.cpp), in the constructor, are you calling CreateDefaultSubobject? Like so:

AProjectileActor::AProjectileActor()
{
	// Use a ProjectileMovementComponent to govern this projectile's movement
	ProjectileMovement = CreateDefaultSubobject<UProjectileMovementComponent>( TEXT( "ProjectileMovementComp" ) );
	ProjectileMovement->UpdatedComponent = WeaponMesh;
	ProjectileMovement->InitialSpeed = 1000.f;
	ProjectileMovement->MaxSpeed = 2000.f;
	ProjectileMovement->bRotationFollowsVelocity = true;
	ProjectileMovement->bShouldBounce = true;
}

In the above example, WeaponMesh is a UStaticMeshComponent that you have declared and created in much the same way.

And then in your ACharacter instance, after some event occurs or function is called, you can spawn your AProjectileActor, give it a direction and it should fire - the initial velocity will cause it to move in the initial direction you set when spawning.

I edited the question, there is an answer for you.

There are various settings, such as InitialSpeed, set that to 0.f and it wont move.
You can also Activate and Deactivate the component. So you could set bAutoActivate to false and when you want to fire it, set the Location and Rotation you want it to move, Activate the component and it will fly off.

You can check all of these settings in the UActorComponent API Docs, which Projectile inherits from.

It might be worth just using simple physics. That way you can teleport the actor (choosing to preserve the velocity or not) and apply a Force (or Impulse, depends on how you want it to fire) in the desired direction.
This way, you don’t even need the Projectile Component.