User talk:Brattle Resident
Jump to navigation
Jump to search
getCurrentAngle performance and code memory
Your method works but it's a bit overkill and doesn't perform very well (in my experience, llRot2Axis and llRot2Angle are slowish). Here's an alternative:
float getCurrentAngle()
{
vector fwd = <1,0,0> * llGetRootRotation();
return llAtan2(fwd.x, fwd.y);
}
I get a speedup of about 2.4x (i.e. more than double) with respect to your method. Note that the <1,0,0> trick is important for performance. Replacing <1,0,0>*rot with llRot2Fwd(rot) the speedup is just about 1.3x. As for memory, it also takes less. --Sei Lisa 15:17, 14 July 2014 (PDT)
Ooh, thanks - if that works that's great! I knew there had to be an easier way than what I did, but nobody knew what it was. I'll try yours out. Brattle Resident 17:52, 14 July 2014 (PDT)