# CFX::GET_SHAPE_TEST_RESULT_INCLUDING_MATERIAL

- **Hash:** `0x4301E10C`
- **Namespace:** CFX
- **Runtime name (Lua/JS):** `GetShapeTestResultIncludingMaterial`
- **Side:** client (Cfx runtime native)
- **Name status:** official
- **Documentation:** described
- **URL:** https://natives.borderlinerp.com/natives/CFX/GET_SHAPE_TEST_RESULT_INCLUDING_MATERIAL

## Signature

```c
int GET_SHAPE_TEST_RESULT_INCLUDING_MATERIAL(int shapeTestHandle, BOOL* hit, Vector3* endCoords, Vector3* surfaceNormal, Hash* materialHash, Entity* entityHit);
```

## Parameters

- `shapeTestHandle` (`int`) — A shape test handle.
- `hit` (`BOOL*`) — Whether or not the shape test hit any collisions.
- `endCoords` (`Vector3*`) — The resulting coordinates where the shape test hit a collision.
- `surfaceNormal` (`Vector3*`) — The surface normal of the hit position.
- `materialHash` (`Hash*`) — hash of the hit material or surface type, see materialFX.dat
- `entityHit` (`Entity*`) — Any dynamic entity hit by the shape test.

## Returns

`int` — `0` if the handle is invalid, `1` if the shape test is still pending, or `2` if the shape test has completed, and the handle should be invalidated.

## Description

*Source: Cfx.re native reference*

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.

## Usage

### Lua

```lua
local retval, hit, endCoords, surfaceNormal, materialHash, entityHit = GetShapeTestResultIncludingMaterial(shapeTestHandle)

-- always available, by hash
local retval, hit, endCoords, surfaceNormal, materialHash, entityHit = Citizen.InvokeNative(0x4301e10c, shapeTestHandle, Citizen.PointerValueInt() --[[ BOOL* ]], Citizen.PointerValueVector(), Citizen.PointerValueVector(), Citizen.PointerValueInt(), Citizen.PointerValueInt(), Citizen.ResultAsInteger())
```

### JavaScript

```js
const [retval, hit, endCoords, surfaceNormal, materialHash, entityHit] = GetShapeTestResultIncludingMaterial(shapeTestHandle);

// by hash
const [retval, hit, endCoords, surfaceNormal, materialHash, entityHit] = Citizen.invokeNative('0x4301e10c', shapeTestHandle, Citizen.pointerValueInt() /* BOOL* */, Citizen.pointerValueVector(), Citizen.pointerValueVector(), Citizen.pointerValueInt(), Citizen.pointerValueInt(), Citizen.returnResultAnyway(), Citizen.resultAsInteger());
```

### C#

```csharp
var hit = new OutputArgument();
var endCoords = new OutputArgument();
var surfaceNormal = new OutputArgument();
var materialHash = new OutputArgument();
var entityHit = new OutputArgument();
int retval = Function.Call<int>((Hash)0x4301e10c, shapeTestHandle, hit, endCoords, surfaceNormal, materialHash, entityHit);
// hit.GetResult<bool>()
// endCoords.GetResult<Vector3>()
// surfaceNormal.GetResult<Vector3>()
// materialHash.GetResult<int>()
// entityHit.GetResult<int>()
```

- Pointer (out) arguments are not passed in Lua/JS: their values are returned after the result, in order.

*Sources: Cfx.re native reference.*
