LSL Problems: llEdgeOfWorld()

Perm url with updates:

LSL Problems: llEdgeOfWorld()

Get your Xah Particle Maker today!

Xah Lee, 2010-06-09

This page documents a bad design in LSL.

Another major LSL idiocy.

There's a LSL function llEdgeOfWorld. Used to detect if if you are near a sim edge. Here's a quote from The official documentation at Source:

integer llEdgeOfWorld( vector pos, vector dir );

Checks to see whether the border hit by dir from pos is the edge of the world (has no neighboring simulator)

Returns an integer that is a boolean.

Here's documentation from, more precise, but same. Quote:

Returns TRUE if the line along the direction dir from the position pos hits the edge of the world in the current simulator. Returns FALSE if that line crosses into another simulator.

Simple enough. So, you think you can use this function, that if there's a neighboring sim, it returns true, else it returns false. WRONG!

For example, in following

llEdgeOfWorld( <128,128,0>, < 5, 0.0, 0.0>)

it checks 5 meters to the east of sim center. Clearly it's not sim edge, but it returns true. Here's the full code you can test:

// 2010-06-09
         if ( llEdgeOfWorld( <128,128,0>, < 5, 0.0, 0.0>))
             llOwnerSay( "llEdgeOfWorld returned true" );
         } else
             llOwnerSay( "llEdgeOfWorld returned false" );

The correct documentation should be like this:

Returns TRUE if the line from pos to pos+dir does crosses sim edge AND that the line do not pass at least 2 regions. Else, return FALSE.

Besides the incorrect documentation problem, the function is just idiotic. It should be as it is documented from the official site. So the problem is probably a sloppy implementation.

One can't imagine how simple things as this can get wrong. I doubt that the Linden Labs are filled with idiotic programers. Perhaps it is more caused by lack of time in startups.

Want to dash through walls?
Try Xah Tele-Dasher!

Popular posts from this blog

11 Years of Writing About Emacs

does md5 creates more randomness?

Google Code shutting down, future of ErgoEmacs