我是 JavaFx 3d 建模的初学者。我正在尝试在房间中创建一个 3d 模型的盒子。我有盒子的尺寸和每个盒子左前下角的坐标。我尝试使用 setTranslateX() 设置坐标,但结果不正确。这是我尝试设置坐标的代码图片:
for (int i = 0; i < Main.load.size(); i++) {
Load l=Main.load.get(i);
Box sphere = new Box(l.getLength()*10, l.getWidth()*10, l.getHeight()*10);
sphere.setTranslateX(l.getX()*10);
sphere.setTranslateY(l.getY()*10);
sphere.setTranslateZ(l.getZ()*10);
PhongMaterial m = new PhongMaterial();
m.setDiffuseColor(new Color(Math.random(),Math.random(),Math.random(),1));
m.setSpecularColor(Color.BLACK);
sphere.setMaterial(m);
root.getChildren().add(sphere);
}
我希望有一个人可以帮助我。
这是一个例子:
尺寸:蓝色 (30,50,50) 粉色 (10,10,20)
位置:蓝色 (0,0,0) 粉色 (30,0,0)