Skip to content

feat(natives): backport colshape natives to fivem + rdr3 - #4081

Open
xalva98 wants to merge 1 commit into
citizenfx:masterfrom
xalva98:backport-colshape-legacy
Open

feat(natives): backport colshape natives to fivem + rdr3#4081
xalva98 wants to merge 1 commit into
citizenfx:masterfrom
xalva98:backport-colshape-legacy

Conversation

@xalva98

@xalva98 xalva98 commented Jul 25, 2026

Copy link
Copy Markdown
Contributor

Goal of this PR

Make the enhanced colshape natives available on legacy GTA5 and RedM.

How is this PR achieving the goal

One shared manager (in citizen-scripting-core) implements the colshape
natives and geometry; a small per-side entity feed (five/rdr3 client, server)
ticks it with nearby entities and it fires onColshapeEnter / onColshapeExit.
A background-built BVH does broad-phase so detection stays cheap with many
shapes. Shapes are tied to the resource that created them and removed when it
stops.

Native names/hashes and event shape match the enhanced API, so scripts written
for enhanced work unchanged.

In plain terms, the detection loop is:

  1. Every ~50 ms, on the game/tick thread, gather a snapshot of nearby entities
    (position + type). This is the only step that touches game state.
  2. Hand that snapshot to a background worker thread and return immediately, so the
    frame/tick is never blocked by the actual detection.
  3. The worker checks each entity against the shapes (a BVH narrows it down to a few
    candidates first) and compares the result to the previous tick to find who just
    entered or left.
  4. The resulting enter/leave transitions are handed back and emitted as
    onColshapeEnter / onColshapeExit on the game/tick thread.

This PR applies to the following area(s)

FiveM, RedM, Natives, FxServer

Successfully tested on

Game builds: 3258 (FiveM), 1491 (RedM), FxServer
Platforms: Windows

Tested thoroughly on both games, client and server: full native/shape/getter
suite plus live enter/exit detection with moving peds, vehicles and objects and
per-entity-type gating. Create/query performance was compared against enhanced
and is roughly on par.

Checklist

  • Code compiles and has been tested successfully.
  • Code is properly formatted and follows the existing style.
  • Commit message is clear and follows the project conventions.
  • This PR introduces no new compilation warnings.

@github-actions github-actions Bot added RedM Issues/PRs related to RedM invalid Requires changes before it's considered valid and can be (re)triaged labels Jul 25, 2026
@CENSOR37

Copy link
Copy Markdown

We need thisssss

@xalva98
xalva98 force-pushed the backport-colshape-legacy branch 2 times, most recently from 9de0adc to 9413b1c Compare August 13, 2026 22:46
Adds the enhanced colshape natives (create/query/delete, point-in-shape, and
per-entity-type detection with onColshapeEnter/onColshapeExit) to legacy GTA5
and RedM, client and server, sharing one manager with a background-built BVH
broad-phase. Shapes are owned by the resource that created them and dropped
when it stops.
@xalva98
xalva98 force-pushed the backport-colshape-legacy branch from 9413b1c to 858fc22 Compare August 13, 2026 22:52
@github-actions github-actions Bot added triage Needs a preliminary assessment to determine the urgency and required action invalid Requires changes before it's considered valid and can be (re)triaged and removed invalid Requires changes before it's considered valid and can be (re)triaged triage Needs a preliminary assessment to determine the urgency and required action labels Aug 13, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

invalid Requires changes before it's considered valid and can be (re)triaged RedM Issues/PRs related to RedM

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants