I'm using Scene for showing 2D stuff over a SubScene for 3D things.
I'm moving the cube using a timer.
The problem is when I move the cursor to over a 2D stuff the moving 3D box will freeze.
Here's a video about the problem: https://drive.google.com/file/d/1Gix2uUBCFNnTxXUtyMsv9MUtQsnx0aLG/view?usp=sharing
And here's the code:
package application;
    
import java.util.Timer;
import java.util.TimerTask;
import javafx.application.Application;
import javafx.event.EventHandler;
import javafx.scene.Group;
import javafx.scene.PerspectiveCamera;
import javafx.scene.Scene;
import javafx.scene.SceneAntialiasing;
import javafx.scene.SubScene;
import javafx.scene.control.Button;
import javafx.scene.input.KeyCombination;
import javafx.scene.input.KeyEvent;
import javafx.scene.layout.AnchorPane;
import javafx.scene.paint.Color;
import javafx.scene.shape.Box;
import javafx.scene.transform.Rotate;
import javafx.scene.transform.Translate;
import javafx.stage.Stage;
public class Main extends Application {
    public static TimerTask timertask1;
    public static Timer timer = new Timer();
    public static Box b1 = new Box(5,5,5);
    @Override public void start(Stage primaryStage) {
        AnchorPane globalRoot = new AnchorPane();
        Scene scene = new Scene(globalRoot, 1366, 768, true);
        PerspectiveCamera camera = new PerspectiveCamera(true);
        Group root3D = new Group();
        SubScene sub = new SubScene(root3D,1366,768,false,SceneAntialiasing.BALANCED);
        camera.getTransforms().addAll(new Rotate(30, Rotate.X_AXIS), new Translate(0, 0, -80));
        sub.setCamera(camera);
        sub.setFill(Color.BLACK);
        globalRoot.getChildren().add(sub);
        root3D.getChildren().add(b1);
        globalRoot.getChildren().add(new Button("Just a button"));
        primaryStage.setFullScreen(true);
        primaryStage.setFullScreenExitHint("");
        primaryStage.setFullScreenExitKeyCombination(KeyCombination.NO_MATCH);
        primaryStage.setScene(scene);
        primaryStage.show();
       startTimer();
    }
     public static void startTimer() { 
            timertask1 = new TimerTask() {
                @Override public void run() {               
                    b1.setTranslateX(b1.getTranslateX()+0.1);                   
                }}; timer.scheduleAtFixedRate(timertask1, 0, 10);}
    public static void main(String[] args) {
        launch(args);
    }
}
Where is my mistake?
