physicsRaycastResult.d.ts 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. import { Vector3 } from "../Maths/math.vector";
  2. import { CastingResult } from "./castingResult";
  3. /**
  4. * Interface for query parameters in the raycast function.
  5. * @see the "Collision Filtering" section in https://github.com/eoineoineoin/glTF/tree/MSFT_RigidBodies/extensions/2.0/Vendor/MSFT_collision_primitives
  6. */
  7. export interface IRaycastQuery {
  8. /** Membership mask */
  9. membership?: number;
  10. /** CollideWith mask */
  11. collideWith?: number;
  12. }
  13. /**
  14. * Holds the data for the raycast result
  15. * @see https://doc.babylonjs.com/features/featuresDeepDive/physics/usingPhysicsEngine
  16. */
  17. export declare class PhysicsRaycastResult extends CastingResult {
  18. private _hitDistance;
  19. private _rayFromWorld;
  20. private _rayToWorld;
  21. /**
  22. * Gets the distance from the hit
  23. */
  24. get hitDistance(): number;
  25. /**
  26. * Gets the hit normal/direction in the world
  27. */
  28. get hitNormalWorld(): Vector3;
  29. /**
  30. * Gets the hit point in the world
  31. */
  32. get hitPointWorld(): Vector3;
  33. /**
  34. * Gets the ray "start point" of the ray in the world
  35. */
  36. get rayFromWorld(): Vector3;
  37. /**
  38. * Gets the ray "end point" of the ray in the world
  39. */
  40. get rayToWorld(): Vector3;
  41. /**
  42. * Sets the distance from the start point to the hit point
  43. * @param distance defines the distance to set
  44. */
  45. setHitDistance(distance: number): void;
  46. /**
  47. * Calculates the distance manually
  48. */
  49. calculateHitDistance(): void;
  50. /**
  51. * Resets all the values to default
  52. * @param from The from point on world space
  53. * @param to The to point on world space
  54. */
  55. reset(from?: Vector3, to?: Vector3): void;
  56. }