Friday, June 29, 2007

LinkRez bug -- multi-prims and geometric centers

Thanks to a user report, I'm aware of a major bug in LinkRez, but a fix is done, and I'm just trying to do a few other tweaks, and give other users a chance to find more bugs, before releasing it.

Basically, it turns out that:
  • llSensor() returns the position of the ROOT prim (used in the sizing board)
  • llGetPosition() returns the position of the ROOT prim
  • llRezObject() rezzes to place the position of the GEOMETRIC center of all prims in a linkset
This doesn't cause a problem if links are SINGLE prims. And it doesn't cause a problem if a necklace chain link is made up of multiple prims, but the root prim is near the 'center' of the linkset.

But, if you use a multiple prim chain link, and the root prim happens to be 'off center', LinkRez will rez the prim 'shifted over' a little bit. Not acceptable. It wasn't caught earlier, because all my test links are either single prims, or linksets where I happened to choose a 'center' prim as the root prim.

Anyhow, the fix was trivial, which was to replace all instances of llRezObject() with llRezAtRoot(), which is based on the root prim position of the object being rezzed, rather than the geometric center.

I wanted to make a few other minor tweaks, so I'll hold off on sending out an update.

This is also a good chance for users to suggest any other (minor) enhancements they'd like to see.