Class PhysicsQueryHit

Hit information from a physics query.

Constructors

Properties

_colliderHandle: Collider
_colliderShape: ColliderShape
_dataUV: Vector2
_distance: number
_normal: Vector3
_point: Vector3
_triangleIndex: number
_unmappedTriangleIndex: number

Accessors

  • get colliderHandle(): Collider
  • Component of the collider that was hit. This may be null if the hit collider has no owner component, in which case refer to ColliderShape.

    Returns Collider

  • get dataUV(): Vector2
  • Barycentric coordinates of the triangle that was hit (only applicable when triangle meshes are hit).

    Returns Vector2

  • get distance(): number
  • Distance from the query origin to the hit position.

    Returns number

  • get normal(): Vector3
  • Normal to the surface that was hit.

    Returns Vector3

  • get point(): Vector3
  • Position of the hit in world space.

    Returns Vector3

  • get triangleIndex(): number
  • Index of the triangle that was hit (only applicable when triangle meshes are hit).

    Returns number

  • get unmappedTriangleIndex(): number
  • Unmapped index of the triangle that was hit (only applicable when triangle meshes are hit). It represents an index into the original MeshData used to Create the PhysicsMesh associated with collider. In contrast, triangleIdx is only a valid index for the MeshData directly obtained from #collider which can differ from the original MeshData due to the internal implementation.

    Returns number

Methods