See Transform3D.lookAt()
I tried it. I wanted my modol to look at the origin (without changing its position) every time I press a button. But it just jumps around (at least the up-vector seems to work). Here's my code:1 2 3 4 5 6 7 8 9
| tg.getTransform(transform3D); Vector3d pos = new Vector3d(); transform3D.get(pos); System.out.println(pos.x +" " + pos.y+" "+pos.z); transform3D = new Transform3D(); transform3D.lookAt(new Point3d(pos.x,pos.y,pos.z),new Point3d(0,0,0), new Vector3d(0,1,0)); tg.setTransform(transform3D); |
Edit: Oh wait, it DOES work. I just forgot that I didnt place my cube3d in the origin (in other words: stupid mistake). OK, thanx.