Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Problem with llSetCameraParams in PoseBall

Jackson Drechsler
Registered User
Join date: 5 Oct 2007
Posts: 10
05-17-2008 11:03
I am trying to make a poseball, that will move and focus an avatar's camera to the
optimal viewing of a planetarium dome.

The following script will work some of the time to move the camera when the avatar sits,
but many times leaves the camera at the default.

Is this A: a bug, or B: What am I doing wrong?

Here is the script. Though echo-checks indicate a proper flow and execution of
the code, it still many times has no effect on the camera, or sets the camera to
the wrong position.

Many thanks -Jackson

CODE

// this code runs without errors, Flows properly, but half the time the avatar
// sits down camera does not set

key avid;


default
{


state_entry()
{
llSitTarget(<-.5,0,0>,<0,0,0,1>); // Sits avatar in upright position
// llSitTarget must be here for llAvatarOnSitTarget to return a key

llSay(0, "Entered Default State");
}//state_entry

touch_start(integer total_number)
{
llSay(0, "Sit here!");

}

changed(integer change)
{
llSay(0, "Changed");
if(change & CHANGED_LINK){ // makes sure that this is a changed link call
llSay(0, "Changed Link");
avid = llAvatarOnSitTarget(); // is an avatar sitting on the target?
llSay(0, "Check Key");
if(avid != NULL_KEY) {
llSay(0, "Requesting Permissions");
llRequestPermissions(avid, PERMISSION_CONTROL_CAMERA);

}
else {
llSay(0, "Null Key");
}
} // if changed Link

} //changed

run_time_permissions(integer p)
{

if(PERMISSION_TRIGGER_ANIMATION & p) {
llSay(0, "ANIMATION Permission Set");
llStartAnimation("nyanya");
}

if(PERMISSION_CONTROL_CAMERA & p) {

llSay(0, "Camera Permission Set");
llClearCameraParams();
llSetCameraParams([
CAMERA_ACTIVE, 1, // 1 is active, 0 is inactive
CAMERA_POSITION, <200.630,204.104,20.664> // region-relative position
]);
llSay(0, "Camera Set");
}// PERMISSION_CONTROL_CAMERA
}//runtime permissions


} // default


BamBam Sachertorte
floral engineer
Join date: 12 Jul 2005
Posts: 228
05-17-2008 21:07
If an agent has focussed their camera before sitting down then llSetCameraParams won't change the focus, but it will change the default camera position. Try hitting ESC a few times to see if the camera goes where you want it.
Kahiro Watanabe
Registered User
Join date: 28 Sep 2007
Posts: 572
05-18-2008 08:15
Also it is recommended to put llSitTarget on on_rez event.