public void selectObject( Object3D target, int mouseX, int mouseY, int screenWidth, int screenHeight, Camera camera) { try { selectedDraggablekObject = target; Ray ray = projector.gwtCreateRay(mouseX, mouseY, screenWidth, screenHeight, camera); // ig dry every thing dont work // Vector3 // rotation=GWTThreeUtils.rotationToVector3((selectedDraggablekObject.getMatrixWorld())); // mouseClickCatcher.getRotation().copy(rotation); selectedDraggablekObject.updateMatrixWorld(true); mouseCatchPlane .getPosition() .copy(GWTThreeUtils.toPositionVec(selectedDraggablekObject.getMatrixWorld())); mouseCatchPlane.updateMatrixWorld(true); // very important JsArray<Intersect> pintersects = ray.intersectObject(mouseCatchPlane); draggableOffset.copy(pintersects.get(0).getPoint()).subSelf(mouseCatchPlane.getPosition()); /* * make a problem? if(draggableOffset.getX()<0.0001){ draggableOffset.setX(0); } if(draggableOffset.getY()<0.0001){ draggableOffset.setY(0); } if(draggableOffset.getZ()<0.0001){ draggableOffset.setZ(0); } */ } catch (Exception e) { LogUtils.log("selectObject:" + e.getMessage()); selectedDraggablekObject = null; } // LogUtils.log("offset:"+ThreeLog.get(draggableOffset)); }
public void copyIntersectedPosition() { // intersectedDraggablekObject.updateMatrixWorld(true); mouseCatchPlane .getPosition() .copy(GWTThreeUtils.toPositionVec(intersectedDraggablekObject.getMatrixWorld())); }