raycast() through multiple objects

I need to be able to detect more than one collision with rayCast(). as soon as rayCast() detects a single object in its path, it stops and spits out the information about the object it detected. I need to use rayCast() for a pip algorithm.

is there a way to do this?

[SOLVED]

I set up a “while” loop that kept raycasting using the last raycast’s hit coordinates until it got a “None” result. every time it got a positive result it adds 1 to a variable. I then use that variable in the pip algorithm.

if there is a better way, feel free to let me know. this works pretty well though.

raycast() has an xray property that keeps going even if it hits something. Check the Blender API for descriptions of everything below.

hit_obj, point, normal = own.rayCast(objto, objfrom, dist, prop, face, xray, poly)

yes, but once it hits something with the correct property, it stops.

Oh I see. You need to detect multiple objects with the correct property. I think your method of sending another ray using a loop might be the only way.