-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
Fix helicopter rotor collides at twice the rotor diameter #40313
Conversation
Round up please, integer division implicitly floors. |
It should be floored, shouldn't it? If D=9, you count 4.5 tiles from the center of the rotor and have the same situation as in the pic |
Co-authored-by: ZhilkinSerg <ZhilkinSerg@users.noreply.github.com>
Sorry for a lack of response, I was sleeping. Let's say Let's say For a rotor with D=5 to have a collision area of 7x7 would be unexpected for the players. |
Let's change |
@@ -419,7 +419,8 @@ bool vehicle::collision( std::vector<veh_collision> &colls, | |||
const tripoint dsp = global_pos3() + dp + parts[p].precalc[1]; | |||
veh_collision coll = part_collision( p, dsp, just_detect, bash_floor ); | |||
if( coll.type == veh_coll_nothing && info.rotor_diameter() > 0 ) { | |||
for( const tripoint &rotor_point : g->m.points_in_radius( dsp, info.rotor_diameter() ) ) { | |||
size_t radius = static_cast<size_t>( std::round( info.rotor_diameter() / 2.0f ) ); |
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.
If division by two really is intended, suggest using divide_round_up
rather than floating-point arithmetic here.
Sounds good to me. The lift thrust calculation can be easily adapted to use |
I understand, I just disagree. From a balance point of view, anything we do here is incredibly generous, from what I've read about helipad layout, minimum safe landing zone footprint is 2D. It is very likely that we will add up to several tiles of horizontal jitter when ascending and descending to represent this. Because of this, I'm not particularly concerned about the, "players will be surprised that they can't land in a tiny area" issue, because that is a fundamentally unsafe thing to do. If you want to alleviate the surprise factor there, we can look into emitting a, "minimum safe distance" number, but that number should be significantly larger than the physical rotor footprint. |
So it basically adds 0.5-1 tile to real radius as a penalty for tiny jitter? Can't argue that. Should be mentioned somewhere in the code probably.
No, it's fine. It was more of a "this code produces wrong R for given D since helicopters are absolutely still" issue. When (if) the jitter is added, the surprise factor will no longer be there since helicopters would be visibly affected by jitter/wind. |
Summary
SUMMARY: Bugfixes "Fix helicopter rotor collides at twice the rotor diameter"
Purpose of change
Fixes #39474
Describe the solution
Divide by 2
Testing
Spawned a helicopter with rotor diameter 8 and placed a wall 5 tiles away.
Ascended, then descended. The helicopter lands safely with this fix but crashes without it.