Shape testsClient5 outputs

getShapeTestResultIncludingMaterial

GET_SHAPE_TEST_RESULT_INCLUDING_MATERIAL0x65287525D951F6BE

The GTA V native GET_SHAPE_TEST_RESULT_INCLUDING_MATERIAL of the SHAPETEST namespace, as LS:MP client scripts call it: the global function getShapeTestResultIncludingMaterial, in JavaScript and in Lua.

SignatureJavaScript
getShapeTestResultIncludingMaterial(shapeTestHandle: number): [
  result: number,
  hit: boolean,
  endCoords: { x: number, y: number, z: number },
  surfaceNormal: { x: number, y: number, z: number },
  materialHash: Hash,
  entityHit: Entity
]
SignatureLua
getShapeTestResultIncludingMaterial(
  shapeTestHandle: integer
): integer, boolean, Vector3, Vector3, Hash, Entity

Usage

JavaScript
const [result, hit, endCoords, surfaceNormal, materialHash, entityHit] =
  getShapeTestResultIncludingMaterial(shapeTestHandle);
Lua
local result, hit, endCoords, surfaceNormal, materialHash, entityHit =
    getShapeTestResultIncludingMaterial(shapeTestHandle)

Parameters

ParameterTypeJavaScriptLua
shapeTestHandleintnumberinteger

Returns

6 values, in this order: an array in JavaScript, multiple return values in Lua.

#ValueTypeJavaScriptLuaDescription
1resultintnumberintegerThe native’s own return value.
2hitBOOLbooleanbooleanoutput
3endCoordsVector3{ x: number, y: number, z: number }Vector3output
4surfaceNormalVector3{ x: number, y: number, z: number }Vector3output
5materialHashHashnumberintegeroutput
6entityHitEntitynumberintegeroutput

Notes

From the community native database. Names are LS:MP’s; samples may be written for C++ or another framework.

Returns the result of a shape test, also returning the material of any touched surface.

When used with an asynchronous shape test, this native should be looped until returning 0 or 2, after which the handle is invalidated.

Unless the return value is 2, the other return values are undefined.

Reference

Namespace
Shape tests SHAPETEST
In the game
int GET_SHAPE_TEST_RESULT_INCLUDING_MATERIAL(int shapeTestHandle, BOOL* hit, Vector3* endCoords, Vector3* surfaceNormal, Hash* materialHash, Entity* entityHit)
Hash
0x65287525D951F6BE
Formerly
_GET_SHAPE_TEST_RESULT_EX

Open in the interactive natives reference