Jump to content

Camera behind third person flight object?


Altier Verwood
 Share

You are about to reply to a thread that has been inactive for 992 days.

Please take a moment to consider if this thread is worth bumping.

Recommended Posts

I've been searching for hours so far and have not found the solution to this. I have a vehicle script I'm working with, and it has a line in it to control the camera, i zeroed everything out, and it works kind of, when i fly to the left or right the camera stays behind the vehicle, but when i fly up or down the camera stays locked on the vehicle, and does not give me a good view of where i am going.

here is the line, i don't know what line to change, i zeroed everything so there should be no lag no offset.

list camNoOffset =[CAMERA_ACTIVE, TRUE,CAMERA_BEHINDNESS_ANGLE, 0.0,CAMERA_BEHINDNESS_LAG, 0,CAMERA_DISTANCE, 0.0,CAMERA_PITCH, 0.0,CAMERA_FOCUS_LAG, 0,CAMERA_FOCUS_LOCKED, FALSE,CAMERA_FOCUS_THRESHOLD, 0.0,CAMERA_POSITION_LAG, 0.0,CAMERA_POSITION_LOCKED, FALSE,CAMERA_POSITION_THRESHOLD, 0.0,CAMERA_FOCUS_OFFSET, <0,0,0>];

any help on this would be appreciated.

Link to comment
Share on other sites

1) if you want to have it not to control the camera, just change it to list camNoOffset =[CAMERA_ACTIVE, FALSE];

2) Unless your plane changes its pitch as it goes up and down, you'd need to do more than just changing the camera parameters to have it intelligently frame your field of view, which might be a bit involved.

 

Link to comment
Share on other sites

Ah, yes that is what i thought, but nothing i do works, i tried many things today and I'm burning out fast, not one has posts any answers clearly anywhere on how to get a camera to follow the rotation of a prim that changes its pitch, or how to get a camera to always stay behind an object, i know it's possible because i have several no mod planes that do it.

i want the camera to always stay behind the flying plane no matter what direction it's going, seems like a huge failure on LL's part to make the camera controls so bad in this game.

can i change the camera based on the rotation of the root prim? if so how would i do that? I've tried using llgetpos and llgetrot for the paramiters but it just comes back with a syntex error.

Link to comment
Share on other sites

From what I can tell, what you're asking for is already the default behavior:


default
{
    state_entry()
    {
        llPassCollisions(TRUE); // because the other script had this and it seems reasonable.
        
        llSetPhysicsMaterial(GRAVITY_MULTIPLIER,0.0,0.0,0.0,0.0); // no gravity.
        
        llSitTarget(<0.6, 0.03, 0.20>, ZERO_ROTATION);
        llSetCameraEyeOffset(<-5.0, -0.00, 2.0> );
        //llSetCameraAtOffset(<3.0, 0.0, 2.0> );
        llSetCameraAtOffset(<0.0, 0.0, 0.0> );
        llSetVehicleType(VEHICLE_TYPE_AIRPLANE);
        
        llSetVehicleFlags(VEHICLE_FLAG_LIMIT_ROLL_ONLY);
        
        llSetVehicleFloatParam(VEHICLE_ANGULAR_MOTOR_DECAY_TIMESCALE,1.0);
        llSetVehicleFloatParam(VEHICLE_ANGULAR_MOTOR_TIMESCALE,0.1);
        llSetVehicleVectorParam(VEHICLE_ANGULAR_FRICTION_TIMESCALE,<1.5,1.5,1.5>); // failed attempt at making the pitch just as responsive as the yaw. 
        llSetVehicleFloatParam(VEHICLE_BANKING_EFFICIENCY,0.0); // do not roll. . . well I tried.
        
        
    }
    changed(integer c)
    {
        if(c&CHANGED_LINK)
        {
            key ID=llAvatarOnSitTarget();
            if(ID)
            {
                llSetStatus(STATUS_PHYSICS, TRUE);
                llRequestPermissions(ID, PERMISSION_TAKE_CONTROLS);
            }else
            {   llSetStatus(STATUS_PHYSICS, FALSE);
                llReleaseControls();
            }
        }
    }
    run_time_permissions(integer perm)
    {
        if(perm) // I don't like this but I'll let it slide.
        {
            llTakeControls(
                CONTROL_FWD |
                CONTROL_BACK |
                CONTROL_RIGHT |
                CONTROL_LEFT |
                CONTROL_ROT_RIGHT |
                CONTROL_ROT_LEFT |
                0, TRUE, FALSE);
        }
    }
    control(key ID, integer level, integer edge)
    {
        integer start = level & edge;
        integer end = ~level & edge;
        integer held = level & ~edge;
        integer untouched = ~(level | edge);
        
        vector angular_motor;
        if(level & CONTROL_FWD)
        {
            angular_motor.y += TWO_PI;
        }
        if(level & CONTROL_BACK)
        {
            angular_motor.y -= TWO_PI ;
        }
        if(level & CONTROL_ROT_RIGHT)
        {
            angular_motor.z -= PI;
        }
        if(level & CONTROL_ROT_LEFT)
        {
            angular_motor.z += PI;
        }
        llSetVehicleVectorParam(VEHICLE_ANGULAR_MOTOR_DIRECTION,angular_motor);
    }
}

 

Link to comment
Share on other sites

Hey there, thank you for your help, I just figured it out a few hours ago after so much trial and error.

its these two lines right here that are what did it, but the explanation of what they do it really bad on the wiki, so i wasn't understanding it.

      llSetCameraEyeOffset(<-5.0, -0.00, 2.0> );
        //llSetCameraAtOffset(<3.0, 0.0, 2.0> );
        llSetCameraAtOffset(<0.0, 0.0, 0.0> );
  • Like 1
Link to comment
Share on other sites

You are about to reply to a thread that has been inactive for 992 days.

Please take a moment to consider if this thread is worth bumping.

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
 Share

×
×
  • Create New...