Skip to content

Fix ground Z offset for MapAndreas/ColAndreas move modes#1

Open
Doomset wants to merge 1 commit into
Mac-Andreas:masterfrom
Doomset:fix/ground-ped-z-offset
Open

Fix ground Z offset for MapAndreas/ColAndreas move modes#1
Doomset wants to merge 1 commit into
Mac-Andreas:masterfrom
Doomset:fix/ground-ped-z-offset

Conversation

@Doomset

@Doomset Doomset commented Jun 9, 2026

Copy link
Copy Markdown

Summary

  • Add kGroundPedZOffset (1.0 m) when applying MapAndreas/ColAndreas ground Z in FCNPCComponent::onTick.
  • Matches original ziggi FCNPC CPlayerData::UpdateHeightPos, which sets fNewZ = groundZ + 1.0f for both move modes.

Problem

With FCNPC_MOVE_MODE_COLANDREAS (and MapAndreas), NPCs visually sink into the ground while moving: ColAndreas returns mesh Z, but the ped origin should sit ~1 m above that surface (same as players). The open.mp port wrote mesh Z directly via npc->setPosition.

Observed on open.mp + ColAndreas: player Z - CA_FindZ ? +1.0, NPC ? +0.1 before fix; after fix both align.

Test plan

  • Load ColAndreas + FCNPC on open.mp with a moving NPC using FCNPC_MOVE_MODE_COLANDREAS.
  • Confirm NPC feet stay on ground while running (no sinking).
  • Repeat with FCNPC_MOVE_MODE_MAPANDREAS if MapAndreas plugin is loaded.
  • FCNPC_MOVE_MODE_NONE unchanged.

Original ziggi FCNPC adds 1.0m to sampled ground Z in UpdateHeightPos; the open.mp port applied mesh Z directly, causing NPCs to sink while moving. Apply the same ped origin offset in onTick after findGroundZ.

Co-authored-by: Cursor <cursoragent@cursor.com>
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.

1 participant