ashwin.sudhir Posted June 9, 2011 Share Posted June 9, 2011 Is there any way to get the pick ray in world space given the mouse coordinates? We plan to use this ray with world.getIntersection() to determine which object is currently under the mouse. Couldn't find any function that did this in world or Player classes. An old forum post mentions getPlayerMouseDirection() but that doesn't seem to be available anymore. It'd be convenient if Unigine offered this instead of us having to construct it from the projection matrix. Thanks, Ashwin. Link to comment
ulf.schroeter Posted June 9, 2011 Share Posted June 9, 2011 Is there any way to get the pick ray in world space given the mouse coordinates? Have a look into <UNIGINE-SDK-root>/data/core/scripts/utils.h for Unigine::getPlayerMouseDirection(vec3 &p0,vec3 &p1). This should be exactly what you need. Also there is a sample for mouse based object picking using this function. Start <UNIGINE-SDK-root>/demos/system_d3d9.bat. Code can be found in <UNIGINE-SDK-root>/data/selection_00.cpp Link to comment
ashwin.sudhir Posted June 10, 2011 Author Share Posted June 10, 2011 Thanks ulf! My only complaint is that this is not discoverable enough. Most engines have this built into the Camera (or equivalent) class. And since this looks like a util script, the documentation does not mention it either (that's where I looked). Link to comment
ulf.schroeter Posted June 10, 2011 Share Posted June 10, 2011 the documentation does not mention it either (that's where I looked). From my experience having a detailed look at ALL provided demos/examples gives you best/fastest overview on function set Link to comment
Recommended Posts