castingResult.d.ts 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. import { Vector3 } from "../Maths/math.vector";
  2. import type { PhysicsShape } from "./v2/physicsShape";
  3. import type { PhysicsBody } from "./v2/physicsBody";
  4. /**
  5. * Base class for results of casts.
  6. */
  7. export declare class CastingResult {
  8. private _hasHit;
  9. protected _hitNormal: Vector3;
  10. protected _hitPoint: Vector3;
  11. private _triangleIndex;
  12. /**
  13. * The Physics body that the query hit.
  14. */
  15. body?: PhysicsBody;
  16. /**
  17. * The body Index in case the Physics body is using instances
  18. */
  19. bodyIndex?: number;
  20. /**
  21. * The shape hit by the query.
  22. */
  23. shape?: PhysicsShape;
  24. /**
  25. * Gets the hit point.
  26. */
  27. get hitPoint(): Vector3;
  28. /**
  29. * Gets the hit normal.
  30. */
  31. get hitNormal(): Vector3;
  32. /**
  33. * Gets if there was a hit
  34. */
  35. get hasHit(): boolean;
  36. get triangleIndex(): number;
  37. /**
  38. * Sets the hit data
  39. * @param hitNormal defines the normal in world space
  40. * @param hitPoint defines the point in world space
  41. * @param triangleIndex defines the index of the triangle in case of mesh shape
  42. */
  43. setHitData(hitNormal: IXYZ, hitPoint: IXYZ, triangleIndex?: number): void;
  44. /**
  45. * Resets all the values to default
  46. */
  47. reset(): void;
  48. }
  49. /**
  50. * Interface for the size containing width and height
  51. */
  52. interface IXYZ {
  53. /**
  54. * X
  55. */
  56. x: number;
  57. /**
  58. * Y
  59. */
  60. y: number;
  61. /**
  62. * Z
  63. */
  64. z: number;
  65. }
  66. export {};