Rotate a 3D object on 3 axis in JavaFX properly

后端 未结 2 527
面向向阳花
面向向阳花 2020-12-09 13:52

So the method that I\'ve used so far to rotate objects in JavaFX was that I layered it in 3 groups, each of them with a Rotate attached and locked to a single axis like so:<

2条回答
  •  执笔经年
    2020-12-09 14:28

    I can offer a solution. But it is a bit uncivilized and might be a discouraged practice.

    Node[] my3dModel = get3DModel();//the method creates a mesh (I suppose that you used Interactive mesh, but it's not important here)
    Pane paneForMyModel = new Pane();
    paneForMyModel.getChildren.addAll(my3dModel);//you add your model to this pane
    //and now
    paneForMyModel.getTransforms().add(new Rotate(angle, axis));
    

提交回复
热议问题