babylon.boneAxesViewer.ts 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. module BABYLON.Debug {
  2. export class BoneAxesViewer extends Debug.AxesViewer {
  3. public mesh:Mesh;
  4. public bone:Bone;
  5. public pos = Vector3.Zero();
  6. public xaxis = Vector3.Zero();
  7. public yaxis = Vector3.Zero();
  8. public zaxis = Vector3.Zero();
  9. constructor(scene: Scene, bone:Bone, mesh: Mesh, scaleLines = 1) {
  10. super(scene, scaleLines);
  11. this.mesh = mesh;
  12. this.bone = bone;
  13. }
  14. public update (): void {
  15. var bone = this.bone;
  16. bone.getAbsolutePositionToRef(this.mesh, this.pos);
  17. bone.getDirectionToRef(Axis.X, this.mesh, this.xaxis);
  18. bone.getDirectionToRef(Axis.Y, this.mesh, this.yaxis);
  19. bone.getDirectionToRef(Axis.Z, this.mesh, this.zaxis);
  20. super.update(this.pos, this.xaxis, this.yaxis, this.zaxis);
  21. }
  22. public dispose() {
  23. if(this.pos){
  24. this.pos = null;
  25. this.xaxis = null;
  26. this.yaxis = null;
  27. this.zaxis = null;
  28. this.mesh = null;
  29. this.bone = null;
  30. super.dispose();
  31. }
  32. }
  33. }
  34. }