Difference between revisions of "LlSetCameraEyeOffset"

From Second Life Wiki
Jump to navigation Jump to search
m (Added caveats)
m (Replaced old <LSL> block with <source lang="lsl2">)
 
(20 intermediate revisions by 4 users not shown)
Line 1: Line 1:
{{LSL_Function
{{LSL_Function
|inject-2={{LSL Function/offset|offset}}
|func_id=243|func_sleep=0.0|func_energy=10.0
|func_id=243|func_sleep=0.0|func_energy=10.0
|func=llSetCameraEyeOffset|p1_type=vector|p1_name=offset
|func=llSetCameraEyeOffset|p1_type=vector|p1_name=offset
|func_footnote
|func_desc=Sets the camera eye {{LSLP|offset}} for avatars that sit on the object.
|func_desc=Sets the camera eye '''offset''' used in this object if an avatar sits on it.
|func_footnote=This is the position of the camera's eye, not the [[llSetCameraAtOffset|point it looks at]].
|return_text
|return_text
|spec
|spec
|caveats=
|caveats=
* The change will only take effect ''next'' time the avatar sits on the prim. You can't change the offset once he has already sit down.
* Setting this will not update the cameras of seated avatars, it will only effect avatars that subsequently sit down.  The camera settings have to be prepared in advance.
* The offset is relative to the object's center and expressed in object coordinates. If you use a sit pose rotation and want to set the camera relatively to your avatar, you must do calculations. If you rotate the object and want to set the camera relatively to the region, you have to do calculations too.
* The {{LSLP|offset}} is [[Viewer_coordinate_frames#Local|locally relative]] to the object, if you want it relative to the seated [[Viewer_coordinate_frames#Agent|avatar]] (which likely has a custom sit rotation and offset) or the [[Viewer_coordinate_frames#Region|region]], you must do the computation yourself.
* [[ZERO_VECTOR]] {{LSLP|offset}} will cancel any eye offset.
* Camera position set by this function is a '''Prim Property'''. '''It will survive the script''' and it will survive prim taking and prim rezzing
|constants
|constants
|examples
|examples=<source lang="lsl2">// Sit the avatar looking at an arbitrary direction
// Look over the avatar's shoulders from behind once it sits down
 
back_view(float degrees)
{
    rotation sitRot = llAxisAngle2Rot(<0, 0, 1>, degrees * DEG_TO_RAD);
   
    llSitTarget(<0, 0, 0.1>, sitRot);
       
    llSetCameraEyeOffset(<-2, 0, 1> * sitRot);
    llSetCameraAtOffset(<2, 0, 1> * sitRot);
}
 
default
{
    state_entry()
    {
        back_view( 208 );
        llSay(0, "Please sit down");
    }
}</source>
|helpers
|helpers
|also_functions=
|also_functions=
{{LSL DefineRow||[[llSetLinkCamera]]|}}
{{LSL DefineRow||[[llSetCameraAtOffset]]|}}
{{LSL DefineRow||[[llSetCameraAtOffset]]|}}
{{LSL DefineRow||[[llForceMouselook]]|}}
{{LSL DefineRow||[[llForceMouselook]]|}}
{{LSL DefineRow||[[llSetCameraParams]]|}}
|also_events
|also_events
|also_tests
|also_tests
|also_articles
|also_articles
|notes|cat1=Camera
|notes
|cat1=Camera
|cat2=Sit
|cat2=Sit
|cat3=Vehicle
|cat3=Vehicle
|cat4
|cat4=Prim
|cat5
|cat6
|cat7
|cat8
}}
}}

Latest revision as of 15:01, 22 January 2015

Summary

Function: llSetCameraEyeOffset( vector offset );

Sets the camera eye offset for avatars that sit on the object.

• vector offset offset relative to the prim's position and expressed in local coordinates

This is the position of the camera's eye, not the point it looks at.

Caveats

  • Setting this will not update the cameras of seated avatars, it will only effect avatars that subsequently sit down. The camera settings have to be prepared in advance.
  • The offset is locally relative to the object, if you want it relative to the seated avatar (which likely has a custom sit rotation and offset) or the region, you must do the computation yourself.
  • ZERO_VECTOR offset will cancel any eye offset.
  • Camera position set by this function is a Prim Property. It will survive the script and it will survive prim taking and prim rezzing
All Issues ~ Search JIRA for related Bugs

Examples

// Sit the avatar looking at an arbitrary direction
// Look over the avatar's shoulders from behind once it sits down

back_view(float degrees)
{
     rotation sitRot = llAxisAngle2Rot(<0, 0, 1>, degrees * DEG_TO_RAD);
    
     llSitTarget(<0, 0, 0.1>, sitRot);
        
     llSetCameraEyeOffset(<-2, 0, 1> * sitRot);
     llSetCameraAtOffset(<2, 0, 1> * sitRot);
}

default
{
    state_entry()
    {
        back_view( 208 );
        llSay(0, "Please sit down");
    }
}

See Also

Deep Notes

Search JIRA for related Issues

Signature

function void llSetCameraEyeOffset( vector offset );