Advertisement
Guest User

Untitled

a guest
Dec 28th, 2014
155
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.05 KB | None | 0 0
  1. `private void camMove(){
  2.  
  3. Point3d newLoc = this.bob.getCurrLoc();
  4. // printTuple(newLoc, "newLoc");
  5. Vector3d trans = new Vector3d( -newLoc.x + this.bobPosn.x,
  6. 0, -newLoc.z + this.bobPosn.z);
  7. this.viewerTG.getTransform( this.t3d );
  8. this.movements3.setTranslation(trans); // overwrites previous translation
  9. this.t3d.mul(this.movements3);
  10. this.viewerTG.setTransform(this.t3d);
  11.  
  12. this.bobPosn = newLoc; // save for next time
  13.  
  14. }
  15. private void camRot(){
  16. this.viewerTG.getTransform( this.t3d );
  17. this.movements.setTranslation(new Vector3d(0,0,-this.ZOFFSET));
  18. this.t3d.mul(this.movements);
  19. this.camrot.rotY(-this.bob.drot); // overwrite previous rotation
  20. this.t3d.mul(this.camrot);
  21. this.movements2.setTranslation(new Vector3d(0,0,this.ZOFFSET));
  22. this.t3d.mul(this.movements2);
  23. this.viewerTG.setTransform(this.t3d);
  24.  
  25. }
  26.  
  27. public void gameupdate(){
  28. if (this.bob.drot != 0){
  29. camRot();
  30. }
  31. if ((this.bob.dx != 0)||(this.bob.dz != 0)){
  32. camMove();
  33. } `
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement