How can you set the Rotation of an object depending on the current position of the mouse?


1 2 3 4 5 6 7 | MouseInfo m = getWorld().getMouseInfo(); if (m != null ) { int x = m.getX() - getX(); int y = m.getY() - getY(); double r = Math.toDegrees(Math.atan2(x, y)); setRotation(-( int ) r); } |