THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 22/09/2006 at 17:05, xxxxxxxx wrote:
User Information:
Cinema 4D Version: 9.102
Platform: Windows ; Mac OSX ;
Language(s) : C++ ;
---------
This is partly a continuation of this topic: DrawPolygonObject and intersections.
I'm using this basic code furnished by Mikael for determining if the cursor is over one of the polygon objects drawn into the viewport using BaseDraw::DrawPolygonObject(). This works perfectly for Pespective. But it fails in every other projection - no intersections. I've tried replacing bd->SW() with my own ScreenToWorld() as derived from the code in BaseView in the documentation - same results.
Selecting real polygon objects works in all projections, but this is using a SelectionList (C4DObjectList) which cannot be used for these 'virtual' polygon objects.
Vector wtail = bd->SW(Vector(x,y,0));
Vector whead = bd->SW(Vector(x,y,10000.0));
Vector otail = (!obj->GetMg()) * wtail;
Vector oray = (whead - wtail) ^ (!obj->GetMg());
rc->Intersect(otail, !oray, 10000.0);
GeRayColResult res;
if (rc->GetNearestIntersection(&res;)) ...
Now, I can't go the other way - get the world point first. This is looking for a world point along the perpendicular from the screen plane at cursor X,Y. Sort of defeatist to require the world point to get the world point (?) for picking.
How does one do this irregardless of projection?
Thanks,