Announcement

Collapse
No announcement yet.

Smooth Camera Transitions with VInterto Problems

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

    Smooth Camera Transitions with VInterto Problems

    I have a side scrolling camera. I'm trying to make it so when the player is facing right the camera is at x1, when the player faces left the camera is at x2.
    I had this all working with no transition (the camera just 'blinks' from one spot to the other).

    I've tried adding the VInterpTo to make the camera have a smooth transition from facing left, to facing right. I haven't had any success. If the interpspeed is greater than 0 then the camera is left at its starting point. If it is 0 then it seems to be starting at it's end point.
    The closest I've gotten to getting it to work was using 'WorldInfo.TimeSeconds' for deltaTime. But that only works for the first few seconds the player starts the level.

    Here's the chunk of my script with the camera:
    (from the pawn, extending UTpawn)

    Code:
    simulated function bool CalcCamera( float fDeltaTime, out vector out_CamLoc, out rotator out_CamRot, out float out_FOV )
    {
        local vector VEndleftLoc;
        local vector VEndRightLoc;
        
    
        VEndLeftLoc = Location;
        VEndLeftLoc.Y = CamOffsetDistance;
        VEndLeftLoc.z += 75;//Up and down for the camera
        VEndLeftLoc.X += 100; //Left and right for the camera
        
        VEndRightLoc = Location;
        VEndRightLoc.Y = CamOffsetDistance;
        VEndRightLoc.z += 75;//Up and down for the camera
        VEndRightLoc.X += -100; //Left and right for the camera
        
        out_CamRot.Pitch = 0; //this controlls the up and down rotaion of the camera
        out_CamRot.Yaw = 16384;
        out_CamRot.Roll = 0;
        //out_camLoc=VEndLeftLoc;
        out_camLoc =VEndRightLoc;
        
        
        if(FaceRight == true) //if pawn is facing right then do this
         {
             //out_camLoc=VEndLeftLoc;
             //So far the only thing that works for delta time: (WorldInfo.TimeSeconds ( x) 0.5), 1.0);
             out_camLoc = VInterpto(VEndLeftLoc,VEndRightLoc, fdeltaTime,25); //90000000000000 does nothing, anything greater tahn 0 leaves the cam at VEndLeftLoc
         }
           
        if(FaceRight ==false) //if pawn is facing left do this
        {
            //out_camLoc =VEndRightLoc;
            out_camLoc = VInterpTo(VEndRightLoc,VEndLeftLoc, fdeltaTime,0.0000001); //0 ends up At where I can the cam to be
        }
    return true;
    }
    tbh, what I've got to this point has been a lot of trial and error (:P) so it's quite possible there's a problem with something else in the function (I'm suspecting it's from the deltaTime... but I'm honestly not sure).
    I've tried everything I can think of (it's an understatement to say I'm not strong at scripting).

    I've tried creating my own deltaTime variable, and calling it there, no change. I've all kinda of numbers in the interpspeed, and the deltatime, I've rearranged where the cameralocations get set... I'm really not sure what else to do.

    I'd really appreciate any help or suggestions to get this working! I feel like I'm probably missing something basic.... ...
    I can post more script as well if more is needed.

    Thanks!

    Edit: Problem solved. I created my own float for delta time that increments up by +1.0. When my camera reaches it's desired destination, I turn a bool to false (stopping the +1.0) and reset the the float back to 0.0 until the transition is needed again (setting the bool to true).
Working...
X