You are currently in the Forum Archive. All content within this area is Read-Only and cannot be modified. Active Forums can be found here.
Reply
Recognized Resident
Zeta Eizenstark
Posts: 6

Camera Reset

I'm having trouble with the camera position not reseting.  I'm trying to set a different camera angle at different times (not in the same instance).  But it saves the last camera position, I'm guessing its because it sets the camera at the state_entry so it uses the old camera position.  Whats the best way to avoid it doing this?  I have linked my code.

back_view()
{
    llSetCameraEyeOffset(<.70, -.037, .85>);
    llSetCameraAtOffset(<.70, -.037, 0>);
}
reset_view()
{
    llSetCameraEyeOffset(<0, 0, 0>);
    llSetCameraAtOffset(<0, 0, 0>);
}
integer pos;
key av = NULL_KEY;
string mg;
default
{
    state_entry()
    {
        llListen(-2,"","","");
        llSitTarget(<0.0, 0.0, 0.1>, ZERO_ROTATION);
    }
   
    changed(integer change)
    {
        if (CHANGED_LINK & change)
        {
             if (llAvatarOnSitTarget() !=av)
             {
                   if (av = llAvatarOnSitTarget())
                   {
                        llSay(-2, "die");
                        llSetTimerEvent(2);
                   }
                   else
                   {
                        llSay(-2, "dim");
                        llResetScript();
                   }
              }
         }
    }
    listen(integer chnl, string s, key k, string msg)
    {
        if(msg == "dying")
        {
            mg = msg;
            llOwnerSay("eat");
            llSay(-2, "eat");
        }
        llRequestPermissions(av, PERMISSION_CONTROL_CAMERA);
    }
   
    run_time_permissions(integer perm)
    {
        if (perm & PERMISSION_CONTROL_CAMERA)
        {
            if (mg == "dying")
                back_view();
            else
                reset_view();
        }
    }
   
    timer()
    {
        if(mg!= "dying")
        {
            llSay(-2, "light");
            llOwnerSay("light");
            llSay(-1, llKey2Name(av));
            llSetTimerEvent(0);
        }
    }
}

Thanks in advance.

Honored Resident
Kahiro Watanabe
Posts: 40

Re: Camera Reset

Reply to Zeta Eizenstark - view message

try with llReleaseCamera();

Recognized Resident
Zeta Eizenstark
Posts: 6

Re: Camera Reset

Reply to Zeta Eizenstark - view message

Doesn't seem to be working either... I looked it up and it says its been "Deprecated".

Void Singer
Posts: 7,475
Solutions: 64
Registered: ‎05-28-2009

Re: Camera Reset

Reply to Zeta Eizenstark - view message

it's probably not your problem, but you need to get the key from llAvatarOnSitTarget before testing for null key (that test will only fire once in a normal scenario). and you really shouldn't go calling functions that require permissions before you verify that you have them in the runtime permissions event.

if (CHANGED_LINK & Change){ //-- did we get a changed link event
     if (llAvatarOnSitTarget() != Av){ //-- was it triggered by an av sitting on or getting up from the sit target?
          if (av = llAvatarOnSitTarget()){ //-- did they just sit down?
               llReqestPermissions( av, PERMISSION_CONTROL_CAMERA ); //-- do stuff with requested permissions in the approriate event
          }else{ //-- they got up
               //-- do stuff for getting up here
          }
     }
}
- Farewell to your ports and good luck to you all
Recognized Resident
Zeta Eizenstark
Posts: 6

Re: Camera Reset

Reply to Zeta Eizenstark - view message

Ok, I updated the script so it uses the run_time event.  The camera still doesn't seem to want to cooperate.  Any Ideas?

Kaluura Boa
Posts: 177
Registered: ‎03-09-2009

Re: Camera Reset

Reply to Zeta Eizenstark - view message

You can forget about permissions... llSetCameraEyeOffset() and llSetCameraAtOffset() are settings like llSitTarget(): You can set them before the AV sits and then as much as you want when the AV is sitting but it has no effect until the AV sits again.

What you want to achieve can only be done with llSetCameraParams()... and, this time, permissions are mandatory or your script will scream on debug channel.

Note however that any attempt to control the camera may fail silently if it's not at the "default position" (like after a few steps) before to sit or manually reset with ESC, ESC. The camera is one of the least cooperative beasts of SL...

Recognized Resident
Zeta Eizenstark
Posts: 6

Re: Camera Reset

Reply to Zeta Eizenstark - view message

Sad Face.