PDA

View Full Version : dragging an object in 3d - I got it!!!!



DalTXColtsFan
09-02-2003, 09:21 AM
A few weeks ago I posted a question of how this could be accomplished - someone (I don't remember who) suggested constructing a ray from the front of the frustum to the back and calculating the point along that line where the object would go. That's exactly what I did, and my demo (requires MFC) is at http://daltxcoltsfan.tripod.com/OpenGL/ProjectAndUnprojectDemo.zip

It's not working perfectly, if you click on the wrong side of the cube the dragging kind of goes backwards, but I'm sure I can figure it out.

The heart of the code is in the PreTranslateMessage member function of the main dialog class.

Let me know what you think and if you have any questions!

Thanks
Joe