David Megginson writes: > > Fixing #2 (mouse actions) > will be a bit harder -- it's quite doable in plib (PrettyPoly did it), but > no one has been able to give me any practical information on how to > accomplish it, besides pointing me to entirely unhelpful code fragments in > plib and ppe.
David Your continuing to bash code < which BTW works well > does not make it easy for those who wrote the 'code' to help you, but .... I will try again Like most things there are many ways one could do this Perhaps the easiest to visualize is to consider a vector as expressed by a starting point and a direction and the intersection of said vector with the scene graph in question. Note this breaks into 3 logical pieces 1) The starting point is relatively easy to conceptualize, it is nothing more then the cursor position on the plane of the viewing screen expressed in the scene graph's world's coordinate space. 2) The direction is equally easy to conceptualize, it is nothing more then the current view direction also expressed in the same coordinate frame as above. 3) The code for the actual intersection already exists in FlightGear in the hitlist mechanism note the similarity: void FGHitList::Intersect( ssgBranch *scene, sgdVec3 orig, sgdVec3 dir ) for a way of doing (1) and (2) you can look at void ppeViewer::update_3D_cursor ( sgVec2 where ) < where == Mouse Coordinates in Screen Pixel space > Note: This function does more then just determining the 'vector' in question but you can ignore that which you don't need there are other ways to accomplish the same if you find this opaque. < other ways left as exercise as the above works but only after much head scratching, hair pulling and consideration by several > > If someone could just write a function that returns the > nearest ssgEntity under a vector projected into the scene graph from a > screen coordinate, we could do the rest. But then there would be no Zen grasshopper :-) Norman _______________________________________________ Flightgear-devel mailing list [EMAIL PROTECTED] http://mail.flightgear.org/mailman/listinfo/flightgear-devel
