Pro Java 9 Games Development Leveraging the JavaFX APIs

(Michael S) #1

Chapter 11 ■ 3D SCene Configuration: uSing the perSpeCtiveCamera anD pointLight


Again, use your Run ➤ Project work process. As you can see in Figure 11-6, your UI screen is now 50
percent larger, so we need to reduce our .setTranslateZ() to zero to synchronize your StackPane with the 3D
Scene projection plane.


The Java code to accomplish this looks like the following and can be seen highlighted in blue in
Figure 11-7:


camera.setTranslateZ( 0 );


Figure 11-7. Set the camera.setTranslateZ() method call to zero to synchronize the StackPane and projection plane


Figure 11-6. Run the project to see that the StackPane is still centered, but the camera Z translate value is still
too far out

Free download pdf