SL includes both first-person and third-person camera modes. By disconnecting the camera from the avatar (to around 50m max away [see Notes below]), a lot more can be done otherwise. Some uses of the camera functions are for vehicles and machinima.
Functions
Function | Description |
llClearCameraParams | Resets all camera values to their defaults. |
llSetCameraParams | Sets camera parameters. |
llForceMouselook | Sets camera to mouselook if an avatar sits on the object. |
llGetCameraPos | Gets current camera position for agent. |
llGetCameraRot | Gets current camera rotation for agent. |
llReleaseCamera | Returns camera to agent. |
llSetCameraAtOffset | Sets camera offset (position) to look at if an avatar sits on the object. |
llSetCameraEyeOffset | Sets camera eye offset if an avatar sits on the object. |
Camera Modes
- Seated Avatar
- Normal sitting camera (llSetCameraEyeOffset, llSetCameraAtOffset)
- Scripted “follow camera” (llSetCameraParams)
- Standing Avatar
- Normal avatar camera
- Scripted “follow camera”
- ALT-Zoom
- Another object or avatar
- A fixed point in space or the ground
- Customize Avatar Mode
- Mouselook
Hitting Esc in modes 3-5 will pop out to modes 1-2, depending on the situation (whether you are sitting or not, for example). When grabbing/touching, the camera mode is 3b where the camera is locked to a fixed point in space. It isn’t a special “grab” camera but just a variation of alt-zoom. Scripted camera controls with llSetCameraParams are not active when in alt-zoom, customize avatar mode, or mouselook.
Notes
- Camera controls are only supported for scripts in objects that are attached to an avatar, or upon which an avatar is sitting. Attempts to use them in stand-alone objects result in the error: “Camera control currently only supported for attachments and objects on which you are sitting.” (1.13.1 (5)). Camera tracking, however, will work with unattached or non-vehicle objects.
- It seems like the camera does not always release properly when unsitting an avatar even though permissions are lost. Its useful to call llReleaseCamera before every llUnSit();.
- The camera can often not behave as one would desire. For example, when zooming in on a masked-textured prim/object, the camera may move beyond it if the mouse was clicked on a transparent part of the masked texture.
- The camera may zoom in unexpectedly when rotated around due to its collision detection with the ground and invisible (transparent) objects.
- You can unlock the 50m limit by going into the Debug menu (press Ctrl+Alt+D to activate) in the Client tab, and by clicking “Disable Camera Constraints”.
Q: How do I take a snapshot with LSL?
A: You can’t. You need both a client (to render the image) and a user (to push the button) to take a snapshot. Short of some sort of macro system running on your computer, there’s no way to automate this process.
A: You can’t. You need both a client (to render the image) and a user (to push the button) to take a snapshot. Short of some sort of macro system running on your computer, there’s no way to automate this process.