How to code drag an object using a mouse in 3D space
I am using OpenGL to drag a 3D object in 3D space. Since I am totally new in OpenGL, I do not understand what other people said about mouse dragging. In fact I need a sample code + explanation, just explanation is not enough for me(unless it is simple and detailed enough). I read other forums too, but I still do not understand.
Such as these forums, I do not understand at all...
http://www.opengl.org/discussion_boards/ubbthreads.php?ubb=showflat&Number开发者_StackOverflow=53232 http://www.opengl.org/discussion_boards/ubbthreads.php?ubb=showflat&Number=296160
My problem is How to do as written??
Mouse movement is in screen coordinates (2D) while object movement is in world space (3D). Therefore you need to restrict the object movement to a line or plane before translating those coordinates.
After you set your movement plane, translating screen coordinates to world coordinates is as simple as casting a ray into the scene, intersecting it with the movement plane.
So it's a two step process. Those links you posted provide more detail. If that is not enough, please show us what you've got and where you got stuck.
精彩评论