Skip to Main Content

Java SE (Java Platform, Standard Edition)

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Rotating a camera

843799Feb 16 2002 — edited Aug 23 2002
I�m trying to set multiple cameras in a virtual universe. Translation works fine, my problem appears when I try to rotate the camera. For example, with front view all works fine, but when I shift the camera to have a top view of my object rotating it Math.PI/2.0 degrees around X axis, object dissapears and I see just a black frame, and if testing others rotation angles, I can just see a portion of object at top or bottom of the window. Same effect occurs when rotation is around another axis. Could be my problem that I'm trying to rotate scene around the origin of the view platform and what I must do is to rotate scene around a fixed axis? How can I solve this problem? Can anybody help me? Thanks
I post the code belows:

public class Camera extends BranchGroup {

private BranchGroup bg;
private Canvas3D vistaGeneral;
private ViewPlatform pl;
private View view;


public Camera(Vector3d pos, Vector3d rot) {

if(v == null) throw new IllegalArgumentException("<Vista3D> es nula.");

bg = new BranchGroup();
addChild(bg);

vistaGeneral = new Canvas3D();
view = new View();
view.addCanvas3D(vistaGeneral);

PhysicalBody body = new PhysicalBody();
view.setPhysicalBody(body);

PhysicalEnvironment environ = new PhysicalEnvironment();
view.setPhysicalEnvironment(environ);

pl = new ViewPlatform();

TransformGroup tg = new TransformGroup();
tg.addChild(pl);

Transform3D tr3d= new Transform3D();
tr3d.setEuler(rot);
tr3d.setTranslation(pos);
tg.setTransform(tr3d);
}
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Sep 20 2002
Added on Feb 16 2002
2 comments
117 views