camera movement

Hi, I’m looking for a tutorial/example of how I could implement a camera using Xith3D. I have a 3d model wich is in the middle of the scene and I just want to be able to move away/closer and from left to right using the keyboard arrows. I was able to move away from the object and get closer to it but when adding the left and right movement, the camera wasn’t moving like it should.

Thanks

The following works fine, if you want to have some kind of first person view. Ie there’s a camera x/y/z-position in the universe and the camera’s alignment as three angles.
The rotation happens in angle degrees (0-360°), and in the order: Y, X, Z which is like Lightwave’s Head, Pitch, Bend philosophy.


private Transform3D mTransform = new Transform3D();
private Transform3D mRotation  = new Transform3D();

mView .. Canvas3d's View, connected to the Universe

private void moveCamera(Point3f position, Tuple3f angle)
{
  mTransform.set(position);

  mRotation.rotY((float) Math.toRadians(angle.y));
  mTransform.mul(mRotation);

  mRotation.rotX((float) Math.toRadians(angle.x));
  mTransform.mul(mRotation);

  mRotation.rotZ((float) Math.toRadians(angle.z));
  mTransform.mul(mRotation);

  mView.setTransform(mTransform);
}

Hi, Thanks for replying I’ll try that :).