Jump to content

Do not cam behind walls when sitting


Quistess Alpha
 Share

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

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

Recommended Posts

@animats mentioned this problem in another topic and I had a spark of an idea for a very simple fix: force the camera to be wherever it was when you sat down.

Ideally this would be integrated into the animation engine (AVsitter) directly, but it's trivial to add as a plugin:

integer neededPerms = 0xC00; // PERMISSION_CONTROL_CAMERA|PERMISSION_TRACK_CAMERA
default
{
    changed(integer c)
    {   if(c&CHANGED_LINK)
        {   // not exact, re-requests when someone stands up.
            key sitter = llGetLinkKey(llGetNumberOfPrims());
            if(llGetAgentSize(sitter)) llRequestPermissions(sitter,neededPerms);
        }
    }
    run_time_permissions(integer perms)
    {   if(perms==neededPerms)
        {   vector pos = llGetCameraPos();
            if(pos) // don't change the camera if there was some very improbable bug.
            {   llSetCameraParams(
                [   CAMERA_ACTIVE, TRUE,
                    CAMERA_POSITION_LOCKED, TRUE,
                    CAMERA_POSITION, pos
                ]);
            }
        }
    }
}

(There may be some minor bugs with multiple sitters when someone stands, haven't tested thoroughly)

  • Thanks 2
Link to comment
Share on other sites

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