<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>http://wiki.osgrid.org/index.php?action=history&amp;feed=atom&amp;title=LlDetectedRot</id>
	<title>LlDetectedRot - Revision history</title>
	<link rel="self" type="application/atom+xml" href="http://wiki.osgrid.org/index.php?action=history&amp;feed=atom&amp;title=LlDetectedRot"/>
	<link rel="alternate" type="text/html" href="http://wiki.osgrid.org/index.php?title=LlDetectedRot&amp;action=history"/>
	<updated>2026-10-25T11:50:08Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.43.11</generator>
	<entry>
		<id>http://wiki.osgrid.org/index.php?title=LlDetectedRot&amp;diff=93&amp;oldid=prev</id>
		<title>Osgridadmin: Created page with &quot;==Function: rotation llDetectedRot( integer number );== Returns a rotation that is the rotation of detected object number. &lt;br&gt; • integer 	number 	– 	Index of detection in...&quot;</title>
		<link rel="alternate" type="text/html" href="http://wiki.osgrid.org/index.php?title=LlDetectedRot&amp;diff=93&amp;oldid=prev"/>
		<updated>2017-12-30T17:50:36Z</updated>

		<summary type="html">&lt;p&gt;Created page with &amp;quot;==Function: rotation llDetectedRot( integer number );== Returns a rotation that is the rotation of detected object number. &amp;lt;br&amp;gt; • integer 	number 	– 	Index of detection in...&amp;quot;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;==Function: rotation llDetectedRot( integer number );==&lt;br /&gt;
Returns a rotation that is the rotation of detected object number. &amp;lt;br&amp;gt;&lt;br /&gt;
• integer 	number 	– 	Index of detection information 	&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
number does not support negative indexes. &amp;lt;br&amp;gt;&lt;br /&gt;
Returns &amp;lt;0.0, 0.0, 0.0, 1.0&amp;gt; if number is not valid sensed object. &amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Specification&amp;#039;&amp;#039;&amp;#039; &amp;lt;br&amp;gt;&lt;br /&gt;
[[llDetected]]* functions can be called anywhere but will only return non-default values if called from within Detection events and functions called by Detection events. &amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Caveats&amp;#039;&amp;#039;&amp;#039; &amp;lt;br&amp;gt;&lt;br /&gt;
• Events that enable the [[llDetected]]* functions always return at least one detected item. &amp;lt;br&amp;gt;&lt;br /&gt;
-• Detection events are not raised if there is nothing detected (with the slight exception of no_sensor but it doesn&amp;#039;t enable [[llDetected]]* functions). &amp;lt;br&amp;gt;&lt;br /&gt;
-• The event detection count parameter value is initially never less than 1.  &amp;lt;br&amp;gt; &amp;lt;br&amp;gt;&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Examples&amp;#039;&amp;#039;&amp;#039; &amp;lt;br&amp;gt;&lt;br /&gt;
{|border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;5&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
|&amp;lt;source lang=&amp;quot;lsl&amp;quot;&amp;gt;&lt;br /&gt;
//--// get compass facing of Avatar that touches this object //--//&lt;br /&gt;
//-- @@ = Contains code optimizations, see the following page for details&lt;br /&gt;
//-- wiki.secondlife.com/wiki/User:Void_Singer/Optimizations&lt;br /&gt;
//-- list of compass directions starting at North, rotated clockwise&lt;br /&gt;
&lt;br /&gt;
list gLstCompassPoints = [ &amp;quot;North&amp;quot;, &amp;quot;NorthEast&amp;quot;, &amp;quot;East&amp;quot;, &amp;quot;SouthEast&amp;quot;, &amp;quot;South&amp;quot;, &amp;quot;SouthWest&amp;quot;, &amp;quot;West&amp;quot;, &amp;quot;NorthWest&amp;quot; ];&lt;br /&gt;
&lt;br /&gt;
//-- convert rotation to z-axis compass direction&lt;br /&gt;
string CompassDirection( rotation rRotBase )&lt;br /&gt;
{&lt;br /&gt;
  integer iCountCompassPoints = llGetListLength(gLstCompassPoints);&lt;br /&gt;
//-- convert rotation to a direction&lt;br /&gt;
  vector vDirection = &amp;lt;0.0, 1.0, 0.0&amp;gt; / rRotBase;&lt;br /&gt;
//-- take the direction and determine the z rotation&lt;br /&gt;
  float fAngle = llAtan2(vDirection.x, vDirection.y);&lt;br /&gt;
//-- take the angle and find the compass point&lt;br /&gt;
  integer iCompassPoint = llRound(fAngle * iCountCompassPoints / TWO_PI);&lt;br /&gt;
//-- convert to string&lt;br /&gt;
  return llList2String( gLstCompassPoints, iCompassPoint );&lt;br /&gt;
}&lt;br /&gt;
 &lt;br /&gt;
default{&lt;br /&gt;
  state_entry()&lt;br /&gt;
  {&lt;br /&gt;
    llSay( 0, &amp;quot;Touch me to get your compass facing&amp;quot; );&lt;br /&gt;
  }&lt;br /&gt;
 &lt;br /&gt;
  touch_start( integer vIntTouchCount )&lt;br /&gt;
  {&lt;br /&gt;
    integer vIntCounter = 0;&lt;br /&gt;
    do&lt;br /&gt;
    {&lt;br /&gt;
      llSay( 0,&lt;br /&gt;
             llDetectedName( vIntCounter )&lt;br /&gt;
             + &amp;quot; is facing &amp;quot;&lt;br /&gt;
              //-- next line gets avatar rotation and converts to compass direction&lt;br /&gt;
             + CompassDirection( llDetectedRot( vIntCounter ) ) );&lt;br /&gt;
    } while ( ++vIntCounter &amp;lt; vIntTouchCount );&lt;br /&gt;
  }&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
|}&lt;/div&gt;</summary>
		<author><name>Osgridadmin</name></author>
	</entry>
</feed>