Currently, we have no way to rotate the avatar. This function would rotate the owner of the script on the Z-axis and would work as an attachment. With this, we can rotate the avatar to the surface normal of a wall, table, or other avatars without the need to use RLV functions that manipulate the camera or having to sit and unsit the avatar. This would allow for things like wall climbing and a host of other useful applications.
rotation RotNormal(vector _normal){
vector vLeft = llVecNorm( _normal % llRot2Fwd(llGetRot()));
vector vFwd = vLeft % _normal;
rotation rRot = llAxes2Rot(vFwd, vLeft, _normal);
return rRot;
}
wall_climb()
{
vector scale = llGetAgentSize(owner);
vector vStart = llGetPos() + <scale.x/2,0,scale.z/2> * llGetRot();
vector vEnd = vStart + <0.25,0,-1.0> * llGetRot();
list CN = llCastRay(vStart, vEnd, [RC_DATA_FLAGS,RC_GET_NORMAL, RC_MAX_HITS, 1]);
float FW_Dist = llVecDist(vStart,llList2Vector(CN, 1) + <scale.x/2,0,0> * RotNormal(llList2Vector(CN, 2)));
/*
Set the position and agent rotation to the surface normal of the detected object.
*/
}