mirror of
https://github.com/godotengine/godot
synced 2024-09-05 05:18:29 +00:00
Fix AABB for unused bones
Fixes bug where bounding box of 1 unit was used in some skinned models and had wrong LODs. (this could become very large if the mesh is scaled, such as FBX conversions) Also fixes a mistake in calcualting bone index.
This commit is contained in:
parent
809a982162
commit
791d8001db
|
@ -534,7 +534,7 @@ AABB MeshStorage::mesh_get_aabb(RID p_mesh, RID p_skeleton) {
|
|||
|
||||
if (skeleton->use_2d) {
|
||||
for (int j = 0; j < bs; j++) {
|
||||
if (skbones[0].size == Vector3()) {
|
||||
if (skbones[j].size == Vector3(-1, -1, -1)) {
|
||||
continue; //bone is unused
|
||||
}
|
||||
|
||||
|
@ -561,7 +561,7 @@ AABB MeshStorage::mesh_get_aabb(RID p_mesh, RID p_skeleton) {
|
|||
}
|
||||
} else {
|
||||
for (int j = 0; j < bs; j++) {
|
||||
if (skbones[0].size == Vector3()) {
|
||||
if (skbones[j].size == Vector3(-1, -1, -1)) {
|
||||
continue; //bone is unused
|
||||
}
|
||||
|
||||
|
|
|
@ -627,7 +627,7 @@ AABB MeshStorage::mesh_get_aabb(RID p_mesh, RID p_skeleton) {
|
|||
|
||||
if (skeleton->use_2d) {
|
||||
for (int j = 0; j < bs; j++) {
|
||||
if (skbones[0].size == Vector3()) {
|
||||
if (skbones[j].size == Vector3(-1, -1, -1)) {
|
||||
continue; //bone is unused
|
||||
}
|
||||
|
||||
|
@ -654,7 +654,7 @@ AABB MeshStorage::mesh_get_aabb(RID p_mesh, RID p_skeleton) {
|
|||
}
|
||||
} else {
|
||||
for (int j = 0; j < bs; j++) {
|
||||
if (skbones[0].size == Vector3()) {
|
||||
if (skbones[j].size == Vector3(-1, -1, -1)) {
|
||||
continue; //bone is unused
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue