Maybe this little example taken from an older thread helps. It's for desktop jPCT and deals with "grabbing" an object like in google earth (hence the class name). But it might help to get you started:
import org.lwjgl.input.Mouse;
import org.lwjgl.opengl.Display;
import com.threed.jpct.*;
import com.threed.jpct.util.Light;
/**
* A Simple demo for mouse-powered object viewing. It offers two modes: Camera around object (default) and object
* "around" camera.
*/
public class GoogleCube
{
private static float distance = 50;
// If true, the object transforms related to the camera. If false, the camera to the object.
private static boolean affectObject = false;
public static void main(String[] args)
throws Exception
{
World world = new World();
FrameBuffer buffer = new FrameBuffer(640, 480, FrameBuffer.SAMPLINGMODE_HARDWARE_ONLY);
buffer.disableRenderer(IRenderer.RENDERER_SOFTWARE);
buffer.enableRenderer(IRenderer.RENDERER_OPENGL);
Object3D cube = Primitives.getSphere(15);
world.addObject(cube);
cube.build();
Camera cam = world.getCamera();
cam.moveCamera(Camera.CAMERA_MOVEUP, distance);
cam.rotateCameraX((float) Math.PI / 2f);
world.setAmbientLight(100, 100, 100);
Light light = new Light(world);
light.setIntensity(0, 0, 255);
light.setPosition(new SimpleVector(-100, 0, 0));
Mouse.create();
while (!Display.isCloseRequested() && !Mouse.isButtonDown(1))
{
buffer.clear();
world.renderScene(buffer);
world.draw(buffer);
buffer.update();
buffer.displayGLOnly();
int x = Mouse.getDX();
int y = Mouse.getDY();
int w = Mouse.getDWheel();
if (Mouse.isButtonDown(0))
{
SimpleVector line = new SimpleVector(x, 0, y);
Matrix m = line.normalize().getRotationMatrix();
if (affectObject)
{
// Object "around" camera
cube.rotateAxis(m.getXAxis(), line.length() / 200f);
}
else
{
// Camera around object
m.rotateAxis(m.getXAxis(), (float) -Math.PI / 2f);
cam.moveCamera(Camera.CAMERA_MOVEIN, distance);
cam.rotateAxis(m.invert3x3().getXAxis(), line.length() / 200f);
cam.moveCamera(Camera.CAMERA_MOVEOUT, distance);
}
}
if (w != 0)
{
float d = w / 200f;
if (affectObject)
{
cube.translate(0, -d, 0);
}
else
{
distance -= d;
cam.moveCamera(Camera.CAMERA_MOVEIN, d);
}
}
Thread.sleep(10);
}
Mouse.setGrabbed(false);
Mouse.destroy();
buffer.disableRenderer(IRenderer.RENDERER_OPENGL);
buffer.dispose();
}
}