physicsEngineComponent.d.ts 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. import type { Nullable } from "../../types";
  2. import type { Observer } from "../../Misc/observable";
  3. import type { Vector3 } from "../../Maths/math.vector";
  4. import type { Mesh } from "../../Meshes/mesh";
  5. import type { Node } from "../../node";
  6. import type { PhysicsImpostor } from "./physicsImpostor";
  7. declare module "../../Meshes/abstractMesh" {
  8. /**
  9. *
  10. */
  11. interface AbstractMesh {
  12. /** @internal */
  13. _physicsImpostor: Nullable<PhysicsImpostor>;
  14. /**
  15. * Gets or sets impostor used for physic simulation
  16. * @see https://doc.babylonjs.com/features/featuresDeepDive/physics
  17. */
  18. physicsImpostor: Nullable<PhysicsImpostor>;
  19. /**
  20. * Gets the current physics impostor
  21. * @see https://doc.babylonjs.com/features/featuresDeepDive/physics
  22. * @returns a physics impostor or null
  23. */
  24. getPhysicsImpostor(): Nullable<PhysicsImpostor>;
  25. /** Apply a physic impulse to the mesh
  26. * @param force defines the force to apply
  27. * @param contactPoint defines where to apply the force
  28. * @returns the current mesh
  29. * @see https://doc.babylonjs.com/features/featuresDeepDive/physics/usingPhysicsEngine
  30. */
  31. applyImpulse(force: Vector3, contactPoint: Vector3): AbstractMesh;
  32. /**
  33. * Creates a physic joint between two meshes
  34. * @param otherMesh defines the other mesh to use
  35. * @param pivot1 defines the pivot to use on this mesh
  36. * @param pivot2 defines the pivot to use on the other mesh
  37. * @param options defines additional options (can be plugin dependent)
  38. * @returns the current mesh
  39. * @see https://www.babylonjs-playground.com/#0BS5U0#0
  40. */
  41. setPhysicsLinkWith(otherMesh: Mesh, pivot1: Vector3, pivot2: Vector3, options?: any): AbstractMesh;
  42. /** @internal */
  43. _disposePhysicsObserver: Nullable<Observer<Node>>;
  44. }
  45. }