Skip to content

Raycast collision bridge (py_map.cpp)#23

Merged
apoguita merged 1 commit into
apoguita:mainfrom
sloppynacho:raycastcpp-only
Jul 2, 2026
Merged

Raycast collision bridge (py_map.cpp)#23
apoguita merged 1 commit into
apoguita:mainfrom
sloppynacho:raycastcpp-only

Conversation

@sloppynacho

Copy link
Copy Markdown
Contributor

Summary

Adds the native PyMap collision-raycast bridge (src/py_map.cpp) that backs the
Python Map.Raycast API. It is a faithful RAW bridge to the engine's
world-intersect primitives plus the live prop-memory walk — it does NO derived math
(normalize, segment length, the blocked decision, hit-point reconstruction and the
prop-mesh v*M transform all live on the Python side).

Engine functions bound (resolved by byte-pattern / assertion-string scanners)

  • RayCastMapCliQueryIntersection — terrain + walkable-prop; returns a hit point.
  • RayCastTerrainITerrain::QueryIntersection — terrain only; returns a parametric fraction [0,1].
  • RayCastInteractiveIProps::IntersectGeometry over each interactive prop, via the
    per-geoset CIGrModel::IntersectCone; returns the threaded nearest distance + winning prop.
    Includes an n_scanned == -1 "probe could not run" sentinel and a unit-vector precondition
    guard against the engine's "Invalid unit vector" abort.
  • GetProps / GetPropGeometry — prop enumeration + raw collision-mesh extraction (Python does v*M).

Notes

RAW native bridge to the engine world-intersect primitives + live prop-memory
walk, backing Py4GWCoreLib Map.Raycast. All derived math (normalize, segment
length, blocked decision, hit reconstruction, prop-mesh v*M) stays in Python;
C++ returns raw engine numbers verbatim.

Binds MapCliQueryIntersection (RayCast), ITerrain::QueryIntersection
(RayCastTerrain, returns a parametric hit fraction), and IProps::IntersectGeometry
via the per-geoset CIGrModel::IntersectCone (RayCastInteractive), plus prop
enumeration (GetProps) and raw collision-mesh extraction (GetPropGeometry).
Includes the n_scanned == -1 "probe could not run" sentinel and a unit-vector
precondition guard against the engine's "Invalid unit vector" abort.
@sloppynacho sloppynacho mentioned this pull request Jun 16, 2026
@apoguita apoguita merged commit 9b77e4f into apoguita:main Jul 2, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants