[C++] Get the camera look at vector

Is this possible?
For example, if I’m spawning an object and want it to move directly away from the camera. Is there a way to get this vector to set the objects velocity?

[EDIT]

To obtain the current rotation of a UCameraComponent:

FRotator Rotation(camComp->componentToWorld.GetRotation());

[/EDIT]

Then use the little snippet from the FPS Tutorial.

void AFPSCharacter::MoveForward(float Value)
    {
        if ( (Controller != NULL) && (Value != 0.0f) )
        {
            // find out which way is forward
            FRotator Rotation = Controller->GetControlRotation();
            // Limit pitch when walking or falling
            if ( CharacterMovement->IsMovingOnGround() || CharacterMovement->IsFalling() )
            {
                Rotation.Pitch = 0.0f;
            }
            // add movement in that direction
            const FVector Direction = FRotationMatrix(Rotation).GetScaledAxis(EAxis::X);
            AddMovementInput(Direction, Value);
        }
    }

I’m not using the ACharacter class. I’m talking about getting the view vector from the UCameraComponent itself. Apologies, I should’ve been more specific.

You can convert a FRotator to a unit FVector using .Vector() like so:

FVector Direction = Rotation.Vector();

This will be the direction the controller is facing, not necessarily directly away from the camera. If you wanted to make it move directly away from the camera, you would want to do this:

// Get a player controller to make sure this is a player pawn.
// Also make sure it has a camera manager.
APlayerController* PC = Cast<APlayerController>(Controller);
if ( PC && PlayerCameraManager )
{
    // Determine direction vector using Dir = B - A
    FVector CameraLocation = PC->PlayerCameraManager->GetCameraLocation();
    FVector MyLocation = GetActorLocation();
    FVector Direction = MyLocation - CameraLocation;

    // Normalize the direction to a unit vector.
    Direction.Normalize();

    // ... now we can do something with the direction!
}

FRotator Rotation(camComp->componentToWorld.GetRotation());
shall return you the FRotator that u can use to get the Forward Vector as described in the code above.

[EDIT]Use getter method instead of attribute[/EDIT]

Thank you very much!