View Single Post
  #3  
Old 08-25-2009, 03:58 PM
omidbrb omidbrb is offline
Member
 
Join Date: Dec 2008
Posts: 27
Hi Jeff,

Thanks a lot for the reply. Pick works exactly as I expected. Unfortunately it doesn't return an id for unnamed objects.

Apart from that, I want to have a function similar to pick, but with arbitrary point in the screen (not bound to the mouse pointer). I wrote the following code, but it's far slower than the pick function. It takes about 5 seconds on each call, but the pick functions looks to be very fast. My question is, how can I implemnet "pick" function with arbitrary coordinate on the 2D screen to be as fast as pick?

Code:
def fireLineAtPointAndReturnIntersectingPoint(normX, normY):
    line = viz.screentoworld([normX, normY])
    dir = viz.Vector(line.dir)
    dir.setLength(200)
    begin = line.begin
    end = line.begin + dir
    info = viz.phys.intersectLine(begin,end)
    return info.point
By the way, I appreciate your instant replies in the forum.

Best,
Omid
Reply With Quote