Jump to content
  • 0

Circling Camera - vectors don't add up


kari1sl
 Share

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

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

Question

  • 0

Hello,

I scripted an example for you.

Just put it into a new prim, then sit on the prim (press the Escape key if you don't see any change immediately, if the camera is still locked):

 

rotate_cam(){    integer iDegree;    for (iDegree = 0; iDegree < 360; iDegree++)    {                rotation vRotArc       = llEuler2Rot( <0.0, 0.0, iDegree> * DEG_TO_RAD ); //-- creates a rotation constant, n degrees around the X axis         vector   vPosOffset     = <0.0, 1.0, 0.0>; //-- creates an offset one meter in the positive Y direction         vector   vPosRotOffset  = vPosOffset * vRotArc; //-- rotates the offset to get the motion caused by the rotation         llSetCameraParams([            CAMERA_ACTIVE, 1, // 1 is active, 0 is inactive            CAMERA_FOCUS, llGetPos(), // region relative position            CAMERA_FOCUS_LOCKED, TRUE, // (TRUE or FALSE)            CAMERA_POSITION, llGetPos() + (vPosOffset * vRotArc), // region relative position            CAMERA_POSITION_LOCKED, TRUE // (TRUE or FALSE)        ]);        llSleep(0.002);    }    llClearCameraParams();    llUnSit(llAvatarOnSitTarget());}default{    state_entry()    {        llSitTarget(<0.0,0.0,0.5>,ZERO_ROTATION);    }    changed(integer change)    {        if (change & CHANGED_LINK && llAvatarOnSitTarget() != NULL_KEY)        {            llRequestPermissions(llAvatarOnSitTarget(), PERMISSION_CONTROL_CAMERA);        }    }    run_time_permissions(integer perm)    {        if (perm & PERMISSION_CONTROL_CAMERA)        {            rotate_cam();        }    }}

 You can IM me with questions in-world.

 

ETA

I used the code from here:

https://wiki.secondlife.com/wiki/Rotation

https://wiki.secondlife.com/wiki/LlSetCameraParams

  • Like 2
Link to comment
Share on other sites

2 answers to this question

Recommended Posts

  • 0

Hello,

I scripted an example for you.

Just put it into a new prim, then sit on the prim (press the Escape key if you don't see any change immediately, if the camera is still locked):

 

rotate_cam(){    integer iDegree;    for (iDegree = 0; iDegree < 360; iDegree++)    {                rotation vRotArc       = llEuler2Rot( <0.0, 0.0, iDegree> * DEG_TO_RAD ); //-- creates a rotation constant, n degrees around the X axis         vector   vPosOffset     = <0.0, 1.0, 0.0>; //-- creates an offset one meter in the positive Y direction         vector   vPosRotOffset  = vPosOffset * vRotArc; //-- rotates the offset to get the motion caused by the rotation         llSetCameraParams([            CAMERA_ACTIVE, 1, // 1 is active, 0 is inactive            CAMERA_FOCUS, llGetPos(), // region relative position            CAMERA_FOCUS_LOCKED, TRUE, // (TRUE or FALSE)            CAMERA_POSITION, llGetPos() + (vPosOffset * vRotArc), // region relative position            CAMERA_POSITION_LOCKED, TRUE // (TRUE or FALSE)        ]);        llSleep(0.002);    }    llClearCameraParams();    llUnSit(llAvatarOnSitTarget());}default{    state_entry()    {        llSitTarget(<0.0,0.0,0.5>,ZERO_ROTATION);    }    changed(integer change)    {        if (change & CHANGED_LINK && llAvatarOnSitTarget() != NULL_KEY)        {            llRequestPermissions(llAvatarOnSitTarget(), PERMISSION_CONTROL_CAMERA);        }    }    run_time_permissions(integer perm)    {        if (perm & PERMISSION_CONTROL_CAMERA)        {            rotate_cam();        }    }}

 You can IM me with questions in-world.

 

ETA

I used the code from here:

https://wiki.secondlife.com/wiki/Rotation

https://wiki.secondlife.com/wiki/LlSetCameraParams

  • Like 2
Link to comment
Share on other sites

  • 0

Just so you know, the best place to post a question like this is the LSL Scripting forum.  That's what it's there for.  Martin and I can answer scripting questions here, but there are many more scripters over there.  They will not only give you a broader selection of answers, they can learn from your challenge too.  Scripters are a puzzle-solving community.  :smileyvery-happy:

Link to comment
Share on other sites

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