GeRayCollider Intersection Test with Whole Scene?

On 01/11/2017 at 13:28, xxxxxxxx wrote:


Short of collapsing the entire scene into a single polygon object is there a simple way to do a GeRayCollider collision test with the entire scene?

Basically, I'm looking for something like:

I'm trying to build a tool that allows me to easily drop an object onto the ground, but I don't want to force users to build a list of "ground" objects ahead of time.

If there isn't a built-in way of doing this, has anyone else already written ray/scene intersection code that would be willing to share?

My initial thoughts on how to approach it would be:
1. Collapse all objects into a single polygon object using SendModelingCommand, CurrentStateToObject & Connect. Unfortunately, this seems incredibly slow and memory inefficient.
2. Test all object bounding boxes to see if they are directly below the ray origin, then convert these to polys and test one at a time.

Also, if there isn't something like this readily available, I'd like to request that it be added to a future version of the SDK. Seems like a pretty common need.



On 01/11/2017 at 13:41, xxxxxxxx wrote:

Also, a small issue with the documentation:

GeRayCollider.Init(goal[, force=False])   
goal (c4d.BaseObject)   

goal actually needs to be a c4d.PolygonObject. It would be great if it accepted a BaseObject and automatically handled the cache/hierarchy, but it doesn't.

On 02/11/2017 at 09:50, xxxxxxxx wrote:

Hi Donovan,

thanks for pointing us to the error in the Python documentation. Will be fixed.

On your initial question we have no better suggestions. Sorry. I'd prefer option 2 for the reasons you already mentioned in option 1.

On 03/11/2017 at 11:54, xxxxxxxx wrote:

Hi Andreas,

Thanks for getting back to me so quickly. I suspected this was the answer, but I wanted to avoid an overly-complicated solution if there was a simple one I was overlooking.