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

Sites: Estimate terrain objects bounding box overlap with site for hiding rocks etc #181

Draft
wants to merge 1 commit into
base: development
Choose a base branch
from

Conversation

dijksterhuis
Copy link
Contributor

@dijksterhuis dijksterhuis commented Jun 18, 2024

TL;DR stop mortars spawned inside rocks soft locking a zone by removing ROCK/ROCKS/HIDE terrain objects with a bounding box estimation.

Estimates whether nearby terrain objects will overlap/intersect with the spawned site, then hides them. Also hides any terrain objects directly on top of those found with bounding box search, otherwise we end up with a bunch of floating bushes. Can be expanded to other kinds of terrain objects on a per site basis.

Requires more testing on my end for both functionality and performance ... so putting up as a draft PR for now.

TODO

  • Use getDir on terrain objects to more accurately calculate overlap/intersections (rectangular area instead of circular?)
  • Test a different clippingType argument for boundingBoxReal https://community.bistudio.com/wiki/boundingBoxReal
  • Calculate site radius using the object with largest 2D distance from site centre point.

screenshots

notes about screenshots

  • used different parameters to what is in this PR. _siteRadius for this example would have been 15, not 5.
  • the large rock terrain object that was hidden has a large maximum dimension, which is why it is hidden even though it's quite far away from the site.
  • rocks on top of other rocks can be problematic, the secondary search with nearestTerrainObjects might want yet another bounding box calculation

debug markers

image

terrain hiding

image

…ding rocks etc.

TL;DR stop mortars spawning inside rocks by removing ROCK/ROCKS/HIDE terrain objects with a bounding box estiamtion.

Estimates whether nearby terrain objects will overlap/intersect with the spawned site, then hides them.
Also hides any terrain objects directly on top of those found with bounding box search, otherwise we end up with a bunch of floating bushes.
Can be expanded to other kinds of terrain objects on a per site basis.

Requires more testing on my end for both functionality and performance ... so putting up as a draft PR for now.
@dijksterhuis
Copy link
Contributor Author

Please can someone confirm that vn_mf_sites_load is non-functional?

Did a grep for wherever the sites data is supposed to get set in the profile DB but came up with nothing.

$ find . -name "*.sqf" -exec grep -Hn 'call para_s_fnc_profile_db' {} \; | grep sites
./mission/functions/systems/sites/fn_sites_load.sqf:19:(["GET", "sites", []] call para_s_fnc_profile_db) params ["","_sitesData"];

@dijksterhuis dijksterhuis marked this pull request as draft June 18, 2024 18:04
};
};

_objsIntersectTerrainObjectsBBox
Copy link
Contributor Author

Choose a reason for hiding this comment

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

👀 this is definitely wrong and needs fixing.

private _pos = [_center, _sizeMax / 4, _sizeMax / 2] call _fnc_findPos;

[_pos] call vn_mf_fnc_sites_create_aa_site;
[_pos, 5] call vn_mf_fnc_sites_hide_terrain_objects_bbox_intersections;
Copy link
Member

Choose a reason for hiding this comment

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

Is this part of MF code scheduled? If it is you should hide terrain objects before spawning.

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