You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2025-11-14 13:41:12 +00:00
BVH - add option for expanded AABBs in leaves
This PR adds a define BVH_EXPAND_LEAF_AABBS which is set, which stores expanded AABBs in the tree instead of exact AABBs. This makes the logic less error prone when considering reciprocal collisions in the pairing, as all collision detect is now taking place between expanded AABB against expanded AABB, rather than expanded AABB against exact AABB. The flip side of this is that the intersection tests will now be less exact when expanded margins are set. All margins are now user customizable via project settings, and take account of collision pairing density to adjust the margin dynamically.
This commit is contained in:
@@ -176,8 +176,11 @@ static String get_full_version_string() {
|
||||
// FIXME: Could maybe be moved to PhysicsServerManager and Physics2DServerManager directly
|
||||
// to have less code in main.cpp.
|
||||
void initialize_physics() {
|
||||
// This must be defined BEFORE the 3d physics server is created
|
||||
// This must be defined BEFORE the 3d physics server is created,
|
||||
// otherwise it won't always show up in the project settings page.
|
||||
GLOBAL_DEF("physics/3d/godot_physics/use_bvh", true);
|
||||
GLOBAL_DEF("physics/3d/godot_physics/bvh_collision_margin", 0.1);
|
||||
ProjectSettings::get_singleton()->set_custom_property_info("physics/3d/godot_physics/bvh_collision_margin", PropertyInfo(Variant::REAL, "physics/3d/godot_physics/bvh_collision_margin", PROPERTY_HINT_RANGE, "0.0,2.0,0.01"));
|
||||
|
||||
/// 3D Physics Server
|
||||
physics_server = PhysicsServerManager::new_server(ProjectSettings::get_singleton()->get(PhysicsServerManager::setting_property_name));
|
||||
|
||||
Reference in New Issue
Block a user