r/JavaFX • • Jun 20 '24

Help Javafx handling perspective

Have used javafx to develop an app for modeling real estate. Uses the Meshview class to create walls, windows, floors, roofs etc then assembled them into a structure somewhat like building with Lego. Difficult part is retaining correct perspective when the model is rotated on its x, y or z axis. Has anyone run into this issue on a similar app?

2 Upvotes

11 comments sorted by

View all comments

Show parent comment

1

u/OddEstimate1627 Jun 22 '24 edited Jun 22 '24

You can make all of your meshes children of a Group and then rotate the Group. Then everything is moved together and you don't have to manually figure out the transform of each part.

You shouldn't need to do any manual sorting based on z-depth. That's what the depth buffer is for.

1

u/Firm_Blueberry5183 Jun 23 '24

I'll give that a try

3

u/Firm_Blueberry5183 Jun 23 '24

I hadn't set the Depth buffer in the SubScene. Like not plugging in the toaster.

It works fine now. Thanks