Free Look Camera

Hi, i’m trying to create a free look camera sistem like this videos

https://youtube.com/watch?v=Zw9aMIzb8vs or this arma 2 video

After doing several tries with blueprints i have realized that i can only do it with c++, maybe overriding some methods, but the question is: “I don’t know where this methods are located and in which classes”.
I know that if i have a controller, it control the rotation of all my components with “Use Pawn Rotation Pitch/Roll”. So for example if i have a camera, i can’t rotate it manually because the controller assume the control of my camera.
So basically i need to write a controller that it let me choose what to control.

There is no example for this on the web, no forum post. I’m struggling for too many days for this.

Can someone help me or pointing me to the right direction? Thanks

Hey, I recognise that…

Check out the Oculus Rift Separate View wiki entry.
It can be used to add free look very easily.

The function you will need to extend and modify is APlayerController::UpdateRotation().

Something like:


void AMyPlayerController::UpdateRotation(float DeltaTime)
{
    // Calculate Delta to be applied on Controllers Rotation
    FRotator DeltaRot(RotationInput);

    // View & Aim are now separate.
    // The controller rotation represents where we are aiming.
    // NewViewRotation represents where we are looking.
    FRotator NewAimRotation = GetControlRotation();
    FRotator NewViewRotation = GetViewRotation();

    // Delta should go into view rotation when freelooking.
    if (bFreeLook)
    {
        PlayerCameraManager->ProcessViewRotation(DeltaTime, NewViewRotation, DeltaRot);
    }
    else
    {
        PlayerCameraManager->ProcessViewRotation(DeltaTime, NewControlRotation, DeltaRot);
    }
    
    SetControlRotation(NewAimRotation);
    
    // If our view and aim are different, call SetViewRotation().
    if (NewViewRotation != NewAimRotation)
    {
        SetViewRotation(NewViewRotation);
    }
 
    APawn* const Pawn = GetPawnOrSpectator();
    if (Pawn)
    {
        Pawn->FaceRotation(NewAimRotation, DeltaTime);
    }
}

You’d probably want to limit how far they can turn etc, but it should basically work.

Hope it helps.

1 Like

It’s not hard to make a free-look camera in blueprints.
Track mouse-right and mouse-up axes, and accumulate into a “camera delta” angle for yaw and pitch.
Then apply a local rotation to your camera based on these values.
This is from my third-person project (thus, panning the spring arm, not the camera itself) but could easily be adopted to a first-person view:

Controller:

Character:

Exactly Kris, I could not have better response if not by the creator of the video :smiley:
You don’t know how many times i’ve opened that page, but maybe i’ve just ignored them. Thank you Kris <3

@jwatte:
Thank you too, but if u have a cameraActor or a springArm attached to a socket i impossible to achieve a good result because the controller stabilize your camera. If you bypass controller the camera will be too much “BOBBED” by the animation. With Kris solution this will not happen. However thank you too so much :smiley:

You can attach the camera to the root of the physics object, rather than the character. Then it will not “bob” at all.