Pro Java 9 Games Development Leveraging the JavaFX APIs

(Michael S) #1
Chapter 11 ■ 3D SCene Configuration: uSing the perSpeCtiveCamera anD pointLight

I expect that this is because the Z translation of the camera is set 1,000 units away from the center of
this new 3D Scene. Therefore, the next thing I am going to try to do is to reduce the camera.setTranslateZ()
method call parameter, from -1000 to -500, to see what the resulting change in the 2D inside of 3D composite
will be.
The Java code to accomplish this modification should look like the following and can be seen
highlighted in blue at the top of Figure 11-5:


camera.setTranslateZ(-500);


Figure 11-4. Run the project; your StackPane is now centered, but your camera object Z translation is too far out


Figure 11-5. Move the camera object 50 percent closer to the 3D scene projection plane by setting
.setTranslateZ() to -500

Free download pdf