mouse rotation

i have written a program that displays knots. I can do rotations on the knot by using the keyboard adn using spherical coordinates. what i wish to add is mouse rotation so that i can click on the knot and make it turn. im not really sure how to do this and have been unable to find any tutorials on the net. if anyone has any advice or know of a tutorials i would greatly appreciate the input. thanks incus

Hi,

The way you recieve mouse events depends on your operating system and developement enviroment. If you can detect when the mouse is clicked on a knot, and after that you get dx and dy meaning the amount the mouse has been moved, it’s easy.

You propably have some function that rotates the knot right some angle. Like what you’d call when the right key is pressed. When the mouse is moved, just use that function to rotate the model dx degrees (possibly scaled). And then use whatever you use for the up key to rotate dy angles.

Well maybe you had already figured that out. If so, what’s the problem? Knowing whether the mouse is on the knot?

-Ilkka