big
This commit is contained in:
@@ -144,6 +144,7 @@ static func _knee_height(skeleton: Skeleton3D) -> float:
|
||||
static func _repair_mesh(mi: MeshInstance3D, skeleton: Skeleton3D, knee: float,
|
||||
chain_l: PackedVector3Array, chain_r: PackedVector3Array,
|
||||
limb_radius: float) -> Array:
|
||||
var safe_bounds := mi.mesh.get_aabb()
|
||||
var side := _side_map(mi.skin, skeleton)
|
||||
var torso_bone := _torso_map(mi.skin, skeleton)
|
||||
var surfaces: Array = []
|
||||
@@ -169,6 +170,14 @@ static func _repair_mesh(mi: MeshInstance3D, skeleton: Skeleton3D, knee: float,
|
||||
rebuilt.surface_set_material(i, entry["material"])
|
||||
if entry["name"] != "":
|
||||
rebuilt.surface_set_name(i, entry["name"])
|
||||
# ArrayMesh rebuilds per-bind bone bounds from ARRAY_BONES. Some runtime
|
||||
# GLBs have a sparse Skin bind table, so that derived array can be longer
|
||||
# than the renderer skeleton and mesh_get_aabb rejects it. A padded bind-pose
|
||||
# bound is conservative for humanoid animation and avoids that invalid path.
|
||||
var padding := Vector3.ONE * maxf(safe_bounds.size.length() * 0.12, 0.25)
|
||||
safe_bounds.position -= padding
|
||||
safe_bounds.size += padding * 2.0
|
||||
rebuilt.custom_aabb = safe_bounds
|
||||
mi.mesh = rebuilt
|
||||
return [snapped, removed]
|
||||
|
||||
|
||||
Reference in New Issue
Block a user