On 17/03/2013 at 05:48, xxxxxxxx wrote:
User Information:
Cinema 4D Version: 14
Platform: Windows ;
Language(s) : C++ ;
---------
Hello;
I am looking for the 3D point (vector) of the nearest object under the cursor in a viewport.
I could use a ViewportSelect, or maybe a GeRayCollider. However, both seem to have a horrible overhead with objects passed and initialized and copied... returning arrays of collision points, and so on, and so on. I am looking for something lightweight.
Now the C4D system is doing something similar when the navigation mode is "Cursor" (WPREF_CAMERAROTATION_CURSOR) : at the start of a movement, the POI is determined by checking the object under the cursor. This needs to be done very often and very fast, so I believe there is a lightweight check behind it, or at least a pre-cached something.
How is this done?
Also, if you are not directly responding to a plugin message that passes the mouse coordinates, how do you get the actual mouse position in the screen or preferably viewport coordinates? All methods that return the "cursor info" are part of a special plugin class; I don't see a method in the BaseView or general classes.
Thanks in advance...