Revisão | ffafa8196549289b527373318f567a2b95194e0a (tree) |
---|---|
Hora | 2021-06-15 00:05:19 |
Autor | sebastian_bugiu |
Commiter | sebastian_bugiu |
Node rotation now seems to be working. More testing needed.
@@ -102,7 +102,7 @@ | ||
102 | 102 | private AutoScalingGroup autoScalingGroup = new AutoScalingGroup(2); |
103 | 103 | private SubdivisionMesh.BoundaryMode boundaryMode = SubdivisionMesh.BoundaryMode.CREASE_EDGES; |
104 | 104 | private final PerspectiveCamera camera = new PerspectiveCamera(true); |
105 | - public static final double cameraDistance = 100; | |
105 | + public static final double cameraDistance = 20; | |
106 | 106 | private final Rotate cameraLookXRotate = new Rotate(0, 0, 0, 0, Rotate.X_AXIS); |
107 | 107 | private final Rotate cameraLookZRotate = new Rotate(0, 0, 0, 0, Rotate.Z_AXIS); |
108 | 108 | // private final Translate cameraPosition = new Translate(0, 0,0); |
@@ -549,11 +549,12 @@ | ||
549 | 549 | } |
550 | 550 | } else if (currentModifier == Modifier.ROTATION) { |
551 | 551 | if (mouseDeltaX != 0 || mouseDeltaY != 0) { |
552 | - Point3D zVec = new Point3D(0, 0, 1); | |
553 | - Point3D mouseVec = new Point3D(flip * mouseDeltaX, yFlip * mouseDeltaY, 0); | |
554 | - Point3D rotAxis = mouseVec.crossProduct(zVec); | |
555 | - rotAxis = rotAxis.normalize(); | |
556 | - ENG_Quaternion currentRot = ENG_Quaternion.fromAngleAxisDegRet(3.0, new ENG_Vector4D(rotAxis.getX(), rotAxis.getY(), rotAxis.getZ(), 1.0)); | |
552 | + ENG_Vector3D zVec = new ENG_Vector3D(0, 0, 1); | |
553 | + ENG_Vector3D mouseVec = new ENG_Vector3D(mouseDeltaX, mouseDeltaY, 0); | |
554 | + ENG_Vector3D rotAxis = mouseVec.crossProduct(zVec); | |
555 | + rotAxis.normalize(); | |
556 | + rotAxis = cameraTransform.getOrientation().mul(rotAxis); | |
557 | + ENG_Quaternion currentRot = ENG_Quaternion.fromAngleAxisDegRet(3.0, new ENG_Vector4D(rotAxis.x, rotAxis.y, rotAxis.z, 1.0)); | |
557 | 558 | currentRot.normalize(); |
558 | 559 | ENG_Quaternion nodeRotation = nodeData.getNodeRotation(); |
559 | 560 | ENG_Quaternion currentOrientationCopy = new ENG_Quaternion(nodeRotation); |
@@ -952,8 +953,8 @@ | ||
952 | 953 | root3D.addEventHandler(KeyEvent.ANY, keyEventHandler); |
953 | 954 | root3D.setFocusTraversable(true); |
954 | 955 | |
955 | - subScene.setOnKeyPressed(event -> System.out.println("subScene keyPressed")); | |
956 | - root3D.setOnKeyPressed(event -> System.out.println("root3d key pressed")); | |
956 | +// subScene.setOnKeyPressed(event -> System.out.println("subScene keyPressed")); | |
957 | +// root3D.setOnKeyPressed(event -> System.out.println("root3d key pressed")); | |
957 | 958 | |
958 | 959 | // Scene scene = subScene.getScene(); |
959 | 960 | // scene.addEventHandler(KeyEvent.ANY, keyEventHandler); |