Follow the mouse with a sphere
in
Contributed Library Questions
•
1 year ago
Hello,
first time I write here :)
I was creating an eye (textured sphere), and the idea is to follow the mouse.
So in the draw method I have rotateX and rotateY:
But this doesn't work, I don't know if I have to adjust the rotation with something apart from mouseX and mouseY.
I hope you can help me, thanks in advance!
first time I write here :)
I was creating an eye (textured sphere), and the idea is to follow the mouse.
So in the draw method I have rotateX and rotateY:
- background(0);
GLGraphics renderer = (GLGraphics)g;
renderer.beginGL();
translate(width/2, height/2, 0);
pushMatrix(); - rotateX(radians(mouseX));
- rotateY(radians(mouseY));
- renderer.model(sphere);
popMatrix();
renderer.endGL();
But this doesn't work, I don't know if I have to adjust the rotation with something apart from mouseX and mouseY.
I hope you can help me, thanks in advance!
1