Jump to content

Camera scripting, help with adjusting a side view


Derceto
 Share

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

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

Recommended Posts

Greetings!

I've been using SL for a few month now and started playing with LSL. I'm especially interrested in using the scripts to control the camera location, focus, etc. in order to be able to re-create the exact same snapshots*.

* By exact, I mean, same camera distance, angle, focus point so that the resulting character snapshot is framed the exact same way.

Many resources are available and I found two ways to interract with the camera:

I understand debug settings are efficient, but I want a HUD or an attachment that directly puts the camera at the right position. 

In "computer baby talk", I want my script to say: "Camera, be at 4m to my right, look at me, always keep a 90° angle to show me in profile, be at 1m above the ground and look horizontally".

It seems simple, but I can't find the correct combination of camera parameters.

I would like some help with my script, and answers to a few questions please :-) The script comes at the end of my post. Based on the flowCam example...

  • Do I need to sit on a prim in order to use the camera positioning scripts fully?
  • Is it possible to create a HUD attachment that makes use of LlSetCameraEyeOffset and LlSetLinkCamera methods?
    • Can these be used in combination with LlSetCameraParams ?
  • Can LlSetCameraParams all be used with a HUD attachment?

 

My script is included in a prim the character has to wear. The "default.attach()" method fails to get the results I try to obtain. I spent hours on this and can't seem to find the solution myself :-) The camera keeps staying right behind the character and I can"t seem to affect the camera's height, neither the point it looks at. What am I doing wrong?

    attach(key agent)
    {
        llOwnerSay("Camera control attached - 2D side camera");
        if (agent)
        {
            setup_listen();
            llRequestPermissions(agent, PERMISSION_CONTROL_CAMERA);
            
            // Setup and data
            llClearCameraParams();
            vector here = llGetPos();
            
            // Approach 1: Set camera eye and target (doesn't have effect!?)
            //llSetCameraEyeOffset(<0, -2, 1>);
            //llSetCameraAtOffset(<0, -2, 0>);
            
            // Aproach 2: Set camera params
            llSetCameraParams([
                CAMERA_ACTIVE, 1, // 1 is active, 0 is inactive
                
                CAMERA_BEHINDNESS_LAG, 0.0, // (0 to 3) seconds
                CAMERA_FOCUS_LAG, 0.0 , // (0 to 3) seconds
                //CAMERA_FOCUS_LOCKED, FALSE, // (TRUE or FALSE)
                CAMERA_FOCUS_THRESHOLD, 0.0, // (0 to 4) meters
        
                CAMERA_POSITION_LAG, 0.0, // (0 to 3) seconds
                CAMERA_POSITION_LOCKED, FALSE, // (TRUE or FALSE)
                CAMERA_POSITION_THRESHOLD, 0.0, // (0 to 4) meters
                CAMERA_BEHINDNESS_ANGLE, 0.0, // (0 to 180) degrees
                        
                CAMERA_POSITION, here + <0.0, -4.0, 1.0>, // region relative position
                CAMERA_PITCH, 0.0, // (-45 to 80) degrees
                CAMERA_DISTANCE, 4.0, // ( 0.5 to 10) meters
                CAMERA_FOCUS, here // region relative position
                //CAMERA_FOCUS_OFFSET, <0, 0, 0> // <-10,-10,-10> to <10,10,10> meters
            ]);
        }
    }
Link to comment
Share on other sites

There are two distinct sets of cam functions. llSetCameraParams can be used by attachments (and, with permission, other stuff), whereas the other three functions only work for things on which the agent is seated.

I think you'll have better luck with llSetCameraParams with CAMERA_FOCUS_LOCKED and -_POSITION_LOCKED set to TRUE.

If you really are trying to recreate the exact same snapshots, though, you may want to consider being seated at a fixed location each time anyway, in which case you could possibly use the other functions.

  • Like 1
Link to comment
Share on other sites

put your cam stuff in a user function and call that from run_time_permissions event?

 

 CAMERA_FOCUS, here // region relative position

 this is focsuing on the avatar center mebbe? not sure if you can adj vector with vec * llGetRot() etc

 

 you could just rotate the prim with llRotLookAt()  and have the cam look straight?

 

 

  • Like 1
Link to comment
Share on other sites

You are about to reply to a thread that has been inactive for 2829 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...