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

Casings - Prevent casings from sinking below terrain level #9711

Draft
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

LinkIsGrim
Copy link
Contributor

When merged this pull request will:

IMPORTANT

  • If the contribution affects the documentation, please include your changes in this pull request so the documentation will appear on the website.
  • Development Guidelines are read, understood and applied.
  • Title of this PR uses our standard template Component - Add|Fix|Improve|Change|Make|Remove {changes}.

@LinkIsGrim LinkIsGrim added the kind/bug-fix Release Notes: **FIXED:** label Jan 3, 2024
private _lisPos = (lineIntersectsSurfaces [_pos, _pos vectorAdd [0,0,-1e11], objNull, objNull, true, 1, "ROADWAY", "FIRE"]) select 0;
private _casingPos = (_lisPos select 0) vectorAdd [0,0,0.005];
if (((ASLtoATL _casingPos) select 2) < 0) then { // prevent casings sinking into the terrain
_casingPos set [2, _unitPos select 2];
Copy link
Contributor

Choose a reason for hiding this comment

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

What about using getTerrainHeightASL instead of the unit's position's z component? I'm not sure if it's compatible with changes done by setTerrainHeight, but I feel it would be more accurate, as I have doubts your solution works well in uneven terrain.
Btw, does this currently account for being in buildings? I imagine so, but I just want to be sure.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Buildings?

Yes. Only change is preventing a negative Z component in relation to the terrain.

getTerrainHeightASL

Didn't know that existed, good to know.

Copy link
Contributor

Choose a reason for hiding this comment

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

I tested with _casingPos set [2, (getTerrainHeightASL _casingPos) vectorAdd [0,0,0.005]];, but it didn't yield good results.

@LinkIsGrim LinkIsGrim marked this pull request as draft January 5, 2024 13:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug-fix Release Notes: **FIXED:**
Projects
None yet
Development

Successfully merging this pull request may close these issues.

No bullet casings on ground
3 participants