babylon.boneAxesViewer.ts 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. module BABYLON.Debug {
  2. export class BoneAxesViewer extends Debug.AxesViewer {
  3. public mesh: Nullable<Mesh>;
  4. public bone: Nullable<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. if (!this.mesh || !this.bone) {
  16. return;
  17. }
  18. var bone = this.bone;
  19. bone.getAbsolutePositionToRef(this.mesh, this.pos);
  20. bone.getDirectionToRef(Axis.X, this.mesh, this.xaxis);
  21. bone.getDirectionToRef(Axis.Y, this.mesh, this.yaxis);
  22. bone.getDirectionToRef(Axis.Z, this.mesh, this.zaxis);
  23. super.update(this.pos, this.xaxis, this.yaxis, this.zaxis);
  24. }
  25. public dispose() {
  26. if (this.mesh){
  27. this.mesh = null;
  28. this.bone = null;
  29. super.dispose();
  30. }
  31. }
  32. }
  33. }