PhysicsTab.ts 956 B

12345678910111213141516171819202122232425262728293031323334
  1. module INSPECTOR{
  2. export class PhysicsTab extends PropertyTab {
  3. public viewer:BABYLON.Debug.PhysicsViewer;
  4. constructor(tabbar:TabBar, inspector:Inspector) {
  5. super(tabbar, 'Physics', inspector);
  6. }
  7. /* Overrides super */
  8. protected _getTree() : Array<TreeItem> {
  9. let arr = new Array<TreeItem>();
  10. let scene = this._inspector.scene;
  11. if(!scene.isPhysicsEnabled()){
  12. return arr;
  13. }
  14. if(!this.viewer){
  15. this.viewer = new BABYLON.Debug.PhysicsViewer(scene);
  16. }
  17. for (let mesh of scene.meshes) {
  18. if (mesh.physicsImpostor) {
  19. arr.push(new TreeItem(this, new PhysicsImpostorAdapter(mesh.physicsImpostor, this.viewer)));
  20. }
  21. }
  22. return arr;
  23. }
  24. }
  25. }