Skip to content

fix(Core/Unit): Improve vehicle exit safety checks and fallback logic#24612

Open
sogladev wants to merge 3 commits intoazerothcore:masterfrom
sogladev:fix/core-unit-mammoth-player-eject
Open

fix(Core/Unit): Improve vehicle exit safety checks and fallback logic#24612
sogladev wants to merge 3 commits intoazerothcore:masterfrom
sogladev:fix/core-unit-mammoth-player-eject

Conversation

@sogladev
Copy link
Member

@sogladev sogladev commented Feb 3, 2026

Changes Proposed:

This PR proposes changes to:

  • Core (units, players, creatures, game systems).
  • Scripts (bosses, spell scripts, creature scripts).
  • Database (SAI, creatures, etc).

AI-assisted Pull Requests

Important

While the use of AI tools when preparing pull requests is not prohibited, contributors must clearly disclose when such tools have been used and specify the model involved.

Contributors are also expected to fully understand the changes they are submitting and must be able to explain and justify those changes when requested by maintainers.

  • AI tools (e.g. ChatGPT, Claude, or similar) were used entirely or partially in preparing this pull request. Please specify which tools were used, if any.

Issues Addressed:

fun is, when you're e.g. standing at a slope and exit the vendors or under passengers, you can throw them under the texture and they will drop unter the world.

#15831 (comment)

SOURCE:

The changes have been validated through:

  • Live research (checked on live servers, e.g Classic WotLK, Retail, etc.)
  • Sniffs (remember to share them with the open source community!)
  • Video evidence, knowledge databases or other public sources (e.g forums, Wowhead, etc.)
  • The changes promoted by this pull request come partially or entirely from another project (cherry-pick). Cherry-picks must be committed using the proper --author tag in order to be accepted, thus crediting the original authors, unless otherwise unable to be found

Tests Performed:

This PR has been:

  • Tested in-game by the author.
  • Tested in-game by other community members/someone else other than the author/has been live on production servers.
  • This pull request requires further testing and may have edge cases to be tested.

.go xyz 1919.7325 795.66583 135.66655 604 4.763204

.go xyz 3320.7324 493.23688 74.50289 615 4.09756

How to Test the Changes:

  • This pull request can be tested by following the reproduction steps provided in the linked issue
  • This pull request requires further testing. Provide steps to test your changes. If it requires any specific setup e.g multiple players please specify it as well.

Known Issues and TODO List:

  • [ ]
  • [ ]

How to Test AzerothCore PRs

When a PR is ready to be tested, it will be marked as [WAITING TO BE TESTED].

You can help by testing PRs and writing your feedback here on the PR's page on GitHub. Follow the instructions here:

http://www.azerothcore.org/wiki/How-to-test-a-PR

REMEMBER: when testing a PR that changes something generic (i.e. a part of code that handles more than one specific thing), the tester should not only check that the PR does its job (e.g. fixing spell XXX) but especially check that the PR does not cause any regression (i.e. introducing new bugs).

For example: if a PR fixes spell X by changing a part of code that handles spells X, Y, and Z, we should not only test X, but we should test Y and Z as well.

Copilot AI review requested due to automatic review settings February 3, 2026 23:21
@github-actions github-actions bot added CORE Related to the core file-cpp Used to trigger the matrix build labels Feb 3, 2026
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.

@Gultask
Copy link
Contributor

Gultask commented Feb 4, 2026

I've got vehicles to consistently drop players OOB, but admittedly that's not really hard to do: #24270

@sogladev sogladev added the WIP Work in Progress. label Feb 4, 2026
Adds line of sight and floor height validation to ensure unit exits
occur at safe, reachable locations. Falls back to vehicle base position.
@sogladev sogladev force-pushed the fix/core-unit-mammoth-player-eject branch from 12dfd14 to 66a8dbd Compare February 6, 2026 06:34
@sogladev sogladev changed the title fix(Core/Unit): disable Travelers Tundra Mammoth exit offset for Players fix(Core/Unit): Improve vehicle exit safety checks and fallback logic Feb 6, 2026
@sogladev sogladev removed the WIP Work in Progress. label Feb 6, 2026
@sogladev
Copy link
Member Author

sogladev commented Feb 6, 2026

I've got vehicles to consistently drop players OOB, but admittedly that's not really hard to do: #24270

I added a line of sight and floor check to fix seatAddon repositioning to invalid locations. This fixes your Gal'darah Impale issue too

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 1 out of 1 changed files in this pull request and generated 2 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

else if (seatAddon->ExitParameter == VehicleExitParameters::VehicleExitParamDest)
pos.Relocate({ seatAddon->ExitParameterX, seatAddon->ExitParameterY, seatAddon->ExitParameterZ, seatAddon->ExitParameterO });

bool isInLoS = GetMap()->isInLineOfSight(GetPositionX(), GetPositionY(), GetPositionZ(), pos.GetPositionX(), pos.GetPositionY(), pos.GetPositionZ(), GetPhaseMask(), LINEOFSIGHT_ALL_CHECKS, VMAP::ModelIgnoreFlags::Nothing);
Copy link

Copilot AI Feb 6, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The LoS check uses Map::isInLineOfSight with raw (x,y,z) from the unit and target position. Unlike WorldObject::IsWithinLOS/IsWithinLOSInMap, this does not account for collision height / hit-sphere points and can produce false negatives (e.g., ray intersecting terrain when both points are near the ground), causing the code to incorrectly fall back to the vehicle's position. Consider using the existing LOS helper on WorldObject/Unit (or at least adding collision-height offsets) for a more reliable check here.

Suggested change
bool isInLoS = GetMap()->isInLineOfSight(GetPositionX(), GetPositionY(), GetPositionZ(), pos.GetPositionX(), pos.GetPositionY(), pos.GetPositionZ(), GetPhaseMask(), LINEOFSIGHT_ALL_CHECKS, VMAP::ModelIgnoreFlags::Nothing);
bool isInLoS = IsWithinLOSInMap(pos.GetPositionX(), pos.GetPositionY(), pos.GetPositionZ(), LINEOFSIGHT_ALL_CHECKS, VMAP::ModelIgnoreFlags::Nothing);

Copilot uses AI. Check for mistakes.
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This signature doesn't exist.

pos.Relocate({ seatAddon->ExitParameterX, seatAddon->ExitParameterY, seatAddon->ExitParameterZ, seatAddon->ExitParameterO });

bool isInLoS = GetMap()->isInLineOfSight(GetPositionX(), GetPositionY(), GetPositionZ(), pos.GetPositionX(), pos.GetPositionY(), pos.GetPositionZ(), GetPhaseMask(), LINEOFSIGHT_ALL_CHECKS, VMAP::ModelIgnoreFlags::Nothing);
float floorZ = vehicleBase->GetMapHeight(pos.GetPositionX(), pos.GetPositionY(), pos.GetPositionZ());
Copy link

Copilot AI Feb 6, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

floorZ is computed via vehicleBase->GetMapHeight(...), but GetMapHeight internally offsets the provided Z by the caller object's collision height. Using the vehicle base (often much larger than the passenger) can change which surface is detected under (x,y), and may incorrectly trigger the fallback. Using the passenger (this->GetMapHeight) or calling Map::GetHeight with an explicit Z offset would avoid vehicle-size-dependent results.

Suggested change
float floorZ = vehicleBase->GetMapHeight(pos.GetPositionX(), pos.GetPositionY(), pos.GetPositionZ());
float floorZ = GetMapHeight(pos.GetPositionX(), pos.GetPositionY(), pos.GetPositionZ());

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CORE Related to the core file-cpp Used to trigger the matrix build Ready to be Reviewed Waiting to be Tested

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants