I misunderstood your question. So basically, you already have the mousedragging — but you want acceleration depending on the the mouse position relative to the sphere?
How about this:
- Register where the user initially clicks on screen. You can do that using the mousePressed(MouseEvent e) method.
- Find the center of the screen
- Multiply the rotation by the distance from the initial mousePressed coordinate to the center-of-screen coordinate.
Example: rotationX = (dragDelta.X * (centerDelta(mouseOrigin.X, Center.X)))
Where dragDelta is the distance the user dragged. Center is the center of screen and mouseOrigin is where the user initially pressed at the start of the drag. The centerDelta method would return a sensible variable based on the distance from mouseOrigin.X to Center.X. So the further away from the center the user clicks, the rotation gains more force.
If I'm still misunderstanding you, and the actual question is how you get an acceleration effect — where the rotation slowly decelerates over time — then the answer would be the above and additionally decreasing the value of
delta from center multiplier over time.
This'd work okay if the sphere is close to you, but might not work so well if the sphere is small on screen. Does this help? Or am I still misunderstanding your question?
EDIT: This, of course, does not depend on the user actually grabbing the sphere. If that's an issue then you could use Interact2D to check if the user is actually clicking on the sphere or not, and then calculating the distance from that point to the center of the sphere (instead of calculating the distance from the click and to the center of the screen).