However, since the upgrade to 0.8.2.0, llCastRay has suddenly become MUCH SLOWER than before. I recall it used to take around 0.025 seconds every time you called it, (which was terrible!) and now it is taking around 0.6 seconds for every call! around 25 times slower!
I recall that there were two versions of llCastRay available, the buggy one and a new one submitted by a developer who wanted a completely working version. But that complete one had an entire copy of ODE inside it and re-built the physics model on every call. So I think there is an option to use the buggy one instead, which just gets the wrong answers without spiking my CPU usage at 200%. I hate to ask for the old bugs back, but this is just too slow to find any uses for it.
Here is a script that measures the time to make a llCastRay call:
Code: Select all
default
{
state_entry()
{
llSay(0, "starting");
float start=llGetTime();
integer i;
for (i=0;i<10;i++)
list hits=llCastRay(llGetPos(),llGetPos()+<5,5,5>,[RC_DETECT_PHANTOM,FALSE,RC_DATA_FLAGS,RC_GET_ROOT_KEY]);
llOwnerSay("time per llCastRay call: "+(string)((llGetTime()-start)/10.0));
}
}