Jump to content

CAMERA CONTROLS - Sit Camera Script Help


Syaoran Nyoki
 Share

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

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

Recommended Posts

Hello. This should be an easy one for a master. 

I am attempting to create a script that will when an avatar is seated in a chair the camera will look squarely at a presentation screen, no matter which seat the avatar is sitting in. The problem is I can't seem to tell the camera which way is forward. For example - My avatar is sitting in a chair facing the screen. I hit ESC and the camera position is correct - except it is looking at a point 90 to my right. I can't seem to get past this one. Please help me.

 

Here is my script.

 

vector focus = <129,129,455>;
vector pos = <126,129,455>;


lookAtMe(integer perms)
{
    if(perms & PERMISSION_CONTROL_CAMERA)
    {
        vector camPos = pos;
        vector camFocus = focus;
        llClearCameraParams();
        llSetCameraParams([
            CAMERA_ACTIVE, 1,
            CAMERA_FOCUS, camFocus,
            CAMERA_FOCUS_LOCKED, TRUE,
            CAMERA_POSITION, camPos,
            CAMERA_POSITION_LOCKED, TRUE
                ]);
    }
}

default
{
    state_entry()
    {
        llSitTarget(<-0.3,0,0.3>, llEuler2Rot(<0,0,180>*DEG_TO_RAD));
    }
    changed(integer change)
    {
        if(change & CHANGED_LINK)
        {
            key agent = llAvatarOnSitTarget();

            if(agent)
            {
                llRequestPermissions(llAvatarOnSitTarget(), PERMISSION_CONTROL_CAMERA);
            }
        }
    }
    run_time_permissions(integer perms)
    {
        lookAtMe(perms);
    }

}


 

Link to comment
Share on other sites

Forward in your example is: fwd=focus-pos = <129,129,455> - <126,129,455> = <3,0,0>

What I am saying is that you must determine focus and pos in a way so that forward is right.
I hope this answers your question:smileyhappy:

Another thing, why do you hit ESC?
ESC releases the camera and makes it resume default and that you can't control with focus and pos settings

Link to comment
Share on other sites


ESC releases the camera and makes it resume default and that you can't control with
focus
and
pos
settings

That's not my experience, which is that if the user's cam is alt-zoomed or -panned away from the default cam position and orientation, they must hit Esc for the scripted cam control to have effect.  

I think that's what the wiki is trying to say, with "Scripted camera parameters will not set for the agent if the last controls they used were their camera controls. Manual camera control will override set parameters too."  The old lslwiki had a more extensive write-up about camera modes.

Link to comment
Share on other sites

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