createColRectangle
Shared
Creates a rectangular collision shape, aligned with the world's axes and with no height limit.
element|false createColRectangle(float x, y, float width, depth)
Parameters
| Name | Type | Description |
|---|---|---|
| x, y | float | The rectangle's corner with the lowest x and y. A vec2 also works. |
| width, depth | float | The size along x and y, in metres. Negative values count as 0. A vec2 also works. |
Returns
The created colshape element, or false if it could not be created.
A collision shape detects players, peds, vehicles and objects by their position and fires onColShapeHit and onColShapeLeave (onClientColShapeHit and onClientColShapeLeave on a client). It goes away when the resource that created it stops.
Example
local parking = createColRectangle(1520.0, -1700.0, 40, 25)