-
Notifications
You must be signed in to change notification settings - Fork 734
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
base: master
Are you sure you want to change the base?
Conversation
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]; |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
When merged this pull request will:
IMPORTANT
Component - Add|Fix|Improve|Change|Make|Remove {changes}
.