Announcement

Collapse
No announcement yet.

How to change a camera's Rotation?

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    How to change a camera's Rotation?

    Hi!

    I've been meddling with making a custom camera for my simple game, yet I can't grasp the very basics yet. For example, I still can't understand how the Camera "sees" or looks at at a certain point.
    My attempts at changing My camera's Self.location and Self.Rotation didn't produce any results. What is then, if not the camera's rotation, that controls the POV?

    The closest i get is the PlayerController's UpdateRotation() function, which in turn calls ProcessViewRotation(), which calls the camera's ProcessViewRotation(), which looks like this:

    Code:
    function ProcessViewRotation(float DeltaTime, out rotator OutViewRotation, out Rotator OutDeltaRot)
    {
        local int ModifierIdx;
    
        for( ModifierIdx = 0; ModifierIdx < ModifierList.Length; ModifierIdx++ )
        {
            if( ModifierList[ModifierIdx] != None )
            {
                if( ModifierList[ModifierIdx].ProcessViewRotation(ViewTarget.Target, DeltaTime, OutViewRotation, OutDeltaRot) )
                {
                    break;
                }
            }
        }
    }
    The above code looks like magic to me (Not the best programmer here), as it calls yet again the ProcessViewRotation From a CameraModifier Class.


    What I'm trying to achieve is leagues simpler than this, and if only i had a rotator and position vector to define my camera or POV, it would be done using simple vector math.


    NOTE: I AM NOT USING A PAWN, WHICH IS THE MAIN REASON FOR MY NEED TO MANUALLY CONTROL THE CAMERA. This is why I cant use CalcCamera() to ovveride the camera behavior.



    Any tips on what is going on with Epic's code?

    #2
    I found the solution:

    Code:
    function UpdateViewTarget(out TViewTarget OutVT, float DeltaTime)
    {
        local Rotator CameraRotation;
        local Vector CameraLocation;
        
        CameraRotation= rotator(vect(0,0,-1));
        CameraLocation= PCOwner.Location;
        
        OutVT.POV.Location = CameraLocation;
        OutVT.POV.Rotation = CameraRotation;
    }
    Happens that the UpdateViewTarget() Function's OutVT.POV.Rotation/Location Can be used to manually manipulate the camera whereabouts and angle. Also, It has a neat FOV feature too @ POV.FOV

    Comment

    Working...
    X