Java Code Examples for com.jme3.renderer.Camera#getRotation()

The following examples show how to use com.jme3.renderer.Camera#getRotation() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: DebugKeysAppState.java    From jmonkeyengine with BSD 3-Clause "New" or "Revised" License 6 votes vote down vote up
@Override
public void onAction(String name, boolean value, float tpf) {
    if (!value) {
        return;
    }

    if (name.equals(INPUT_MAPPING_CAMERA_POS)) {
        Camera cam = app.getCamera();
        if (cam != null) {
            Vector3f loc = cam.getLocation();
            Quaternion rot = cam.getRotation();
            System.out.println("Camera Position: ("
                    + loc.x + ", " + loc.y + ", " + loc.z + ")");
            System.out.println("Camera Rotation: " + rot);
            System.out.println("Camera Direction: " + cam.getDirection());
            System.out.println("cam.setLocation(new Vector3f("
                    + loc.x + "f, " + loc.y + "f, " + loc.z + "f));");
            System.out.println("cam.setRotation(new Quaternion(" + rot.getX() + "f, " +rot.getY()+ "f, " + rot.getZ() + "f, " + rot.getW() + "f));");
          
        }
    } else if (name.equals(INPUT_MAPPING_MEMORY)) {
        BufferUtils.printCurrentDirectMemory(null);
    }
}
 
Example 2
Source File: EditorTransformSupport.java    From jmonkeybuilder with Apache License 2.0 4 votes vote down vote up
@Override
@JmeThread
public @NotNull Quaternion getToolRotation(@NotNull final Transform transform,
                                           @NotNull final Camera camera) {
    return camera.getRotation();
}
 
Example 3
Source File: CameraTweens.java    From Lemur with BSD 3-Clause "New" or "Revised" License 4 votes vote down vote up
/**
 *  Creates a tween that will interpolate the rotation of the specified target 
 *  from one rotation to another.  If either rotation is null then they will 
 *  be substituted with the Camera's current local rotation AT THE TIME OF THIS CALL.
 */
public static Tween rotate( Camera target, Quaternion from, Quaternion to, double length ) {
    from = from != null ? from : target.getRotation();
    to = to != null ? to : target.getRotation();
    return new RotateCamera(target, from, to, length);
}