collision_hit table reference - Stingray Lua API Reference

collision_hit table reference

Description

This table is used to record a single collision point made by a collision test against a physics world.

See the stingray.Raycast object description for details.

This table doesn't have any named members. It's an array whose values are accessible using numeric keys:

  • [1] : The position of the collision in the 3D world, as a stingray.Vector3.
  • [2] : The distance of the collision point from the starting point of the collision test, as a number.
  • [3] : The normal of the surface that was hit, as a stingray.Vector3.
  • [4] : The physics actor that was hit, as a stingray.Actor.

For example, you would access the world position of the collision point as local collision_point = hit_result[1].