BGE: Fix T46557: Empty collision bounds option with character physics
- Fix in rna_object.c rna_GameObjectSettings_physics_type_set->The collision bounds type can't be empty for character physics - Add do_version for the .blends already saved with collision bounds option empty (characters) Reviewers: campbellbarton, panzergame, lordloki Reviewed By: panzergame, lordloki Subscribers: lordloki Projects: #game_engine Maniphest Tasks: T46557 Differential Revision: https://developer.blender.org/D1576
This commit is contained in:
parent
9eb7eb5379
commit
40b2e75b20
Notes:
blender-bot
2023-02-14 08:31:04 +01:00
Referenced by issue #46622, Consistent segfault with 2 particle systems, in 2 layers and mballs Referenced by issue #46557, [BUG] BGE steering
|
@ -909,6 +909,15 @@ void blo_do_versions_270(FileData *fd, Library *UNUSED(lib), Main *main)
|
|||
#undef LA_YF_PHOTON
|
||||
}
|
||||
|
||||
{
|
||||
Object *ob;
|
||||
for (ob = main->object.first; ob; ob = ob->id.next) {
|
||||
if (ob->body_type == OB_BODY_TYPE_CHARACTER && (ob->gameflag & OB_BOUNDS) && ob->collision_boundtype == OB_BOUND_TRIANGLE_MESH) {
|
||||
ob->boundtype = ob->collision_boundtype = OB_BOUND_BOX;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
{
|
||||
|
@ -925,4 +934,6 @@ void blo_do_versions_270(FileData *fd, Library *UNUSED(lib), Main *main)
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -1036,6 +1036,11 @@ static void rna_GameObjectSettings_physics_type_set(PointerRNA *ptr, int value)
|
|||
ob->gameflag |= OB_COLLISION | OB_CHARACTER;
|
||||
ob->gameflag &= ~(OB_SENSOR | OB_OCCLUDER | OB_DYNAMIC | OB_RIGID_BODY | OB_SOFT_BODY | OB_ACTOR |
|
||||
OB_ANISOTROPIC_FRICTION | OB_DO_FH | OB_ROT_FH | OB_COLLISION_RESPONSE | OB_NAVMESH);
|
||||
/* When we switch to character physics and the collision bounds is set to triangle mesh
|
||||
we have to change collision bounds because triangle mesh is not supported by Characters*/
|
||||
if ((ob->gameflag & OB_BOUNDS) && ob->collision_boundtype == OB_BOUND_TRIANGLE_MESH) {
|
||||
ob->boundtype = ob->collision_boundtype = OB_BOUND_BOX;
|
||||
}
|
||||
break;
|
||||
case OB_BODY_TYPE_STATIC:
|
||||
ob->gameflag |= OB_COLLISION;
|
||||
|
|
Loading…
Reference in New Issue