You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2025-11-12 13:20:55 +00:00
Portals - Allow user to set roaming expansion margin
Previously a crude metric was used to decide on the roaming expansion margin, but it created unexpected results in some scenarios. Instead this setting is exposed to the user via the RoomManager, allowing them to tailor it to the world size, room sizes, roaming objects sizes and the speeds of movement.
This commit is contained in:
@@ -822,20 +822,6 @@ void PortalRenderer::rooms_finalize(bool p_generate_pvs, bool p_cull_using_pvs,
|
||||
// from position
|
||||
_rooms_lookup_bsp.create(*this);
|
||||
|
||||
// calculate the roaming expansion margin based on the average room size
|
||||
Vector3 total_size = Vector3(0, 0, 0);
|
||||
for (int n = 0; n < get_num_rooms(); n++) {
|
||||
total_size += get_room(n)._aabb.size;
|
||||
}
|
||||
if (get_num_rooms()) {
|
||||
total_size /= get_num_rooms();
|
||||
AABB temp;
|
||||
temp.size = total_size;
|
||||
|
||||
// longest axis of average room * fudge factor
|
||||
_roaming_expansion_margin = temp.get_longest_axis_size() * 0.08;
|
||||
}
|
||||
|
||||
// calculate PVS
|
||||
if (p_generate_pvs) {
|
||||
PVSBuilder pvs;
|
||||
|
||||
Reference in New Issue
Block a user