flagflag  

llLookAt() by Janus Dugong anchor.png

       public void llLookAt(LSL_Vector target, double strength, double damping)
       {
           m_host.AddScriptLPS(1);
           // Determine where we are looking from
           LSL_Vector from = llGetPos();

           // normalized direction to target
           LSL_Vector dir = llVecNorm(target - from);

           // Janus Dugong & Fumi.Hax
           if (LSL_Vector.Mag(dir)<=0.0) return;
           //
           LSL_Vector vec_yaw = new LSL_Vector(0.0, 0.0, Math.Atan2(dir.y, dir.x));    // yaw
           LSL_Vector vec_pth = new LSL_Vector(0.0, Math.Acos(dir.z), 0.0);            // pitch
           LSL_Rotation rot_yaw = llEuler2Rot(vec_yaw);
           LSL_Rotation rot_pth = llEuler2Rot(vec_pth);
           LSL_Rotation rot = rot_pth * rot_yaw;

           // Per discussion with Melanie, for non-physical objects llLookAt appears to simply
           // set the rotation of the object, copy that behavior
           PhysicsActor pa = m_host.PhysActor;

           if (strength == 0 || pa == null || !pa.IsPhysical)
           {
               llSetRot(rot);
           }
           else
           {
               m_host.StartLookAt(rot, (float)strength, (float)damping);
           }
       }

Front page   Freeze Diff Backup Copy Rename Reload   New List of Pages Search Recent changes   Help   RSS of recent changes (RSS 1.0) RSS of recent changes (RSS 2.0) RSS of recent changes (RSS Atom)
Counter: 1418, today: 1, yesterday: 0
Last-modified: 2015-02-26 (Thu) 22:16:41 (JST) (3778d) by iseki

Site Search

Login

Username:

Password:


Lost Password?
Register now!!

Sub Menu

mini Calendar

Last MonthJul 2025Next Month
Su Mo Tu We Th Fr Sa
1 2 3 4 5
6 7 8 9 10 11 12
13 14 15 16 17 18 19
20 21 22 23 24 25 26
27 28 29 30 31
Today

Who's Online

51 user(s) are online (16 user(s) are browsing xpwiki)

Members: 0
Guests: 51

more...

Access Counter

Today : 7204720472047204
Yesterday : 2190021900219002190021900
Total : 2735928227359282273592822735928227359282273592822735928227359282
Powered by XOOPS Cube 2.1© 2001-2006 XOOPS Cube Project
Design by XoopsDesign.com