Mesh Rotation
Hi
how to implement mouse rotation like that :
http://www.cse.unsw.edu.au/%7Elambert/java/3d/hull.html
1) Handle WM_LBUTTONDOWN, set isDragging = true, store mousePosX and mousePosY
2) Handle WM_LBUTTONUP, set isDragging = false
3) Each frame: if isDragging == true, get newMousePosX and newMousePosY (try GetCursorPos() ), calculate mouse delta for either axis based on mousePosX and mousePosY, multiply these by some speed factor (eg, 0.004), increment rotationOnXAxis, rotationOnYAxis and/or rotationOnZAxis based on the deltas and rotate the scene. Finally don't forget to set mousePosAxis to newMousePosAxis.
If this makes no sense, go over it again and if it still makes no sense, try to formulate your problem more clearly.
2) Handle WM_LBUTTONUP, set isDragging = false
3) Each frame: if isDragging == true, get newMousePosX and newMousePosY (try GetCursorPos() ), calculate mouse delta for either axis based on mousePosX and mousePosY, multiply these by some speed factor (eg, 0.004), increment rotationOnXAxis, rotationOnYAxis and/or rotationOnZAxis based on the deltas and rotate the scene. Finally don't forget to set mousePosAxis to newMousePosAxis.
If this makes no sense, go over it again and if it still makes no sense, try to formulate your problem more clearly.
"Literally, it means that Bob is everything you can think of, but not dead; i.e., Bob is a purple-spotted, yellow-striped bumblebee/dragon/pterodactyl hybrid with a voracious addiction to Twix candy bars, but not dead."- kSquared
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement