i think you have lot of models in your scene, maybe you should optimeze your
modelsunderloc comand with a list of arguments.
check the entry of the livedocs from Charles Parcell:
ModelsUnderRay & Loc
3D Picking has been enhanced to take advantage of user/application's a
priori knowledge. Two 3D picking apis now can take an optional parameter
specifying the list of models to traverse when checking for picking:
modelsUnderRay() and modelsUnderLoc().
These two apis have been extended to take an optional property list as its
third and second parameter respectively. The old api still works. Here is a
-- build your modelList
modelList = [model1, model4, model7, model8]
-- build your optional argument list
argList = [#maxNumberOfModels:10,
-- determine picking
list1 = s3dCastMember.modelsUnderRay(locationVector, directionVector,argList)
list2 = s3dCastMember.camera(1).modelsUnderLoc(pointWithin Sprite, argList)
It should be noted that the optional argument list (property list) can contain
any of the optional parmeters. For example, argList = [#maxNumberOfModels:5,
#modelList:myModelList] is perfectly acceptable. The level of detail here will
be the default, which is #simple.
Also, when building your modelList for picking, you must explicitly include
all models that you are interested in. The 3D engine will not automatically
include the children of your modelList when determining picking. If you want a
hierarchy of models to be included for picking, you must traverse this
hierarchy yourself and explicitly add it to your modelList.
may be this can help you to speed up your script.