Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(extra-natives-five): add Collision Detection system [CLIENT] #3117

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
932 changes: 932 additions & 0 deletions code/components/extra-natives-five/src/ColshapeNatives.cpp

Large diffs are not rendered by default.

18 changes: 18 additions & 0 deletions ext/native-decls/CreateColshapeCircle.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
---
ns: CFX
apiset: client
game: gta5
---
## CREATE_COLSHAPE_CIRCLE
```c
bool CREATE_COLSHAPE_CIRCLE(char* colShapeId, float x, float y, float z, float radius);
```
Creates a circular shape. The game will check for collision and fire either onPlayerEnterColshape or onPlayerLeaveColshape with the colShapeId.
## Parameters
* **colShapeId**: The Identifier of the colshape.
* **x**: The X coordinate of the center of the circle.
* **y**: The Y coordinate of the center of the circle.
* **z**: The Z coordinate of the center of the circle.
* **radius**: The radius of the circle.
## Return value
true if created successfully, false if identifier is already taken.
20 changes: 20 additions & 0 deletions ext/native-decls/CreateColshapeCube.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
---
ns: CFX
apiset: client
game: gta5
---
## CREATE_COLSHAPE_CUBE
```c
bool CREATE_COLSHAPE_CUBE(char* colShapeId, float x1, float y1, float z1, float x2, float y2, float z2);
```
Creates a cube shape. The game will check for collision and fire either onPlayerEnterColshape or onPlayerLeaveColshape with the colShapeId.
## Parameters
* **colShapeId**: The Identifier of the colshape.
* **x1**: The X coordinate of the first corner of the cube.
* **y1**: The Y coordinate of the first corner of the cube.
* **z1**: The Z coordinate of the first corner of the cube.
* **x2**: The X coordinate of the opposite corner of the cube.
* **y2**: The Y coordinate of the opposite corner of the cube.
* **z2**: The Z coordinate of the opposite corner of the cube.
## Return value
true if created successfully, false if identifier is already taken.
19 changes: 19 additions & 0 deletions ext/native-decls/CreateColshapeCylinder.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
---
ns: CFX
apiset: client
game: gta5
---
## CREATE_COLSHAPE_CYLINDER
```c
bool CREATE_COLSHAPE_CYLINDER(char* colShapeId, float x, float y, float z, float radius, float height);
```
Creates a cylinder shape. The game will check for collision and fire either onPlayerEnterColshape or onPlayerLeaveColshape with the colShapeId.
## Parameters
* **colShapeId**: The Identifier of the colshape.
* **x**: The X coordinate of the center of the cylinder.
* **y**: The Y coordinate of the center of the cylinder.
* **z**: The Z coordinate of the bottom of the cylinder.
* **radius**: The radius of the cylinder.
* **height**: The height of the cylinder.
## Return value
true if created successfully, false if identifier is already taken.
20 changes: 20 additions & 0 deletions ext/native-decls/CreateColshapeRectangle.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
---
ns: CFX
apiset: client
game: gta5
---
## CREATE_COLSHAPE_RECTANGLE
```c
bool CREATE_COLSHAPE_RECTANGLE(char* colShapeId, float x1, float y1, float x2, float y2, float bottomZ, float height);
```
Creates a rectangle shape. The game will check for collision and fire either onPlayerEnterColshape or onPlayerLeaveColshape with the colShapeId.
## Parameters
* **colShapeId**: The Identifier of the colshape.
* **x1**: The X coordinate of the first corner.
* **y1**: The Y coordinate of the first corner.
* **x2**: The X coordinate of the opposite corner.
* **y2**: The Y coordinate of the opposite corner.
* **bottomZ**: The bottom Z coordinate of the rectangle.
* **height**: The height of the rectangle.
## Return value
true if created successfully, false if identifier is already taken.
18 changes: 18 additions & 0 deletions ext/native-decls/CreateColshapeSphere.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
---
ns: CFX
apiset: client
game: gta5
---
## CREATE_COLSHAPE_SPHERE
```c
bool CREATE_COLSHAPE_SPHERE(char* colShapeId, float x, float y, float z, float radius);
```
Creates a sphere shape. The game will check for collision and fire either onPlayerEnterColshape or onPlayerLeaveColshape with the colShapeId.
## Parameters
* **colShapeId**: The Identifier of the colshape.
* **x**: The X coordinate of the center of the sphere.
* **y**: The Y coordinate of the center of the sphere.
* **z**: The Z coordinate of the center of the sphere.
* **radius**: The radius of the sphere.
## Return value
true if created successfully, false if identifier is already taken.
14 changes: 14 additions & 0 deletions ext/native-decls/DeleteColshape.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
---
ns: CFX
apiset: client
game: gta5
---
## DELETE_COLSHAPE
```c
bool DELETE_COLSHAPE(char* colShapeId);
```
Deletes a colshape by identifier
## Parameters
* **colShapeId**: The Identifier of the colshape to be deleted.
## Return value
true if deleted successfully, false if it didn't exist in the first place
14 changes: 14 additions & 0 deletions ext/native-decls/DoesColshapeExist.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
---
ns: CFX
apiset: client
game: gta5
---
## DOES_COLSHAPE_EXIST
```c
bool DOES_COLSHAPE_EXIST(char* colShapeId);
```
Checks whether a collision shape exists by its identifier.
## Parameters
* **colShapeId**: The Identifier of the colshape.
## Return value
true if it exists, false if not.
Loading