From 577c60dab1f6bc3eb52405dc29e1cfae34ddd846 Mon Sep 17 00:00:00 2001 From: krustophski Date: Thu, 18 Jun 2026 07:35:36 +0300 Subject: [PATCH] Rebuild KAMAZ rig without ragdoll physics --- .../Vehicles/Kamaz/SK_Kamaz_Chassis.uasset | 4 +- Source/mrPlow58/Kamaz/mrPlow58KamazCar.cpp | 1 + Tools/Unreal/clear_kamaz_physics_asset.py | 40 +++++++++++++++++++ Tools/Unreal/import_kamaz_chassis.py | 2 +- Tools/VehiclePipeline/clean_kamaz_source.py | 4 +- .../prepare_vehicle_exports.py | 12 ++++-- VehicleExports/SK_Kamaz_Chassis.fbx | 2 +- VehicleExports/SM_Kamaz_Broom.fbx | 2 +- VehicleExports/SM_Kamaz_Gruz.fbx | 2 +- VehicleExports/SM_Kamaz_Kuzov.fbx | 2 +- VehicleExports/SM_Kraz_BladeBucket.fbx | 2 +- VehicleExports/SM_Kraz_BodyForBulk.fbx | 2 +- ...real_clear_kamaz_physics_asset_report.json | 6 +++ .../unreal_import_kamaz_chassis_report.json | 2 +- ...l_inspect_kamaz_playable_setup_report.json | 22 +++++----- 15 files changed, 77 insertions(+), 28 deletions(-) create mode 100644 Tools/Unreal/clear_kamaz_physics_asset.py create mode 100644 VehicleExports/unreal_clear_kamaz_physics_asset_report.json diff --git a/Content/MrPlow/Vehicles/Kamaz/SK_Kamaz_Chassis.uasset b/Content/MrPlow/Vehicles/Kamaz/SK_Kamaz_Chassis.uasset index 0c1b2d6..8c3b9ce 100644 --- a/Content/MrPlow/Vehicles/Kamaz/SK_Kamaz_Chassis.uasset +++ b/Content/MrPlow/Vehicles/Kamaz/SK_Kamaz_Chassis.uasset @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:7a3dd94fb9f639be32cea4a9baa58906e045aaf79f1585e468c6b35dfe8e365e -size 121292816 +oid sha256:bbd3d48b33f5330890a07f6cbab4cfc8b9d06e5eca7a8ab38abd9bf38bccd5e6 +size 121290853 diff --git a/Source/mrPlow58/Kamaz/mrPlow58KamazCar.cpp b/Source/mrPlow58/Kamaz/mrPlow58KamazCar.cpp index 7f07062..3f85ab0 100644 --- a/Source/mrPlow58/Kamaz/mrPlow58KamazCar.cpp +++ b/Source/mrPlow58/Kamaz/mrPlow58KamazCar.cpp @@ -26,6 +26,7 @@ AmrPlow58KamazCar::AmrPlow58KamazCar() GetMesh()->SetSkeletalMesh(KamazMesh.Object); } + GetMesh()->SetPhysicsAsset(nullptr); GetMesh()->SetCollisionProfileName(FName("Vehicle")); GetFrontSpringArm()->SetRelativeLocation(FVector(220.0f, -55.0f, 285.0f)); diff --git a/Tools/Unreal/clear_kamaz_physics_asset.py b/Tools/Unreal/clear_kamaz_physics_asset.py new file mode 100644 index 0000000..b81b6c3 --- /dev/null +++ b/Tools/Unreal/clear_kamaz_physics_asset.py @@ -0,0 +1,40 @@ +import json +from pathlib import Path + +import unreal + + +PROJECT_DIR = Path(unreal.Paths.project_dir()) +REPORT_PATH = PROJECT_DIR / "VehicleExports" / "unreal_clear_kamaz_physics_asset_report.json" +MESH_PATH = "/Game/MrPlow/Vehicles/Kamaz/SK_Kamaz_Chassis.SK_Kamaz_Chassis" + + +def asset_path(asset): + return asset.get_path_name() if asset else None + + +def main(): + mesh = unreal.load_asset(MESH_PATH) + if not mesh: + raise RuntimeError(f"Missing mesh: {MESH_PATH}") + + before = asset_path(mesh.get_editor_property("physics_asset")) + mesh.set_editor_property("physics_asset", None) + unreal.EditorAssetLibrary.save_loaded_asset(mesh) + after = asset_path(mesh.get_editor_property("physics_asset")) + + report = { + "mesh": MESH_PATH, + "beforePhysicsAsset": before, + "afterPhysicsAsset": after, + "ok": after is None, + } + REPORT_PATH.parent.mkdir(parents=True, exist_ok=True) + REPORT_PATH.write_text(json.dumps(report, indent=2), encoding="utf-8") + + if after is not None: + raise RuntimeError(f"Physics asset still assigned: {report}") + + +if __name__ == "__main__": + main() diff --git a/Tools/Unreal/import_kamaz_chassis.py b/Tools/Unreal/import_kamaz_chassis.py index 0ba692c..68e3f97 100644 --- a/Tools/Unreal/import_kamaz_chassis.py +++ b/Tools/Unreal/import_kamaz_chassis.py @@ -30,7 +30,7 @@ def import_chassis(): options.set_editor_property("import_as_skeletal", True) options.set_editor_property("import_materials", False) options.set_editor_property("import_textures", False) - options.set_editor_property("create_physics_asset", True) + options.set_editor_property("create_physics_asset", False) options.set_editor_property("mesh_type_to_import", unreal.FBXImportType.FBXIT_SKELETAL_MESH) skeletal_data = options.get_editor_property("skeletal_mesh_import_data") diff --git a/Tools/VehiclePipeline/clean_kamaz_source.py b/Tools/VehiclePipeline/clean_kamaz_source.py index 9ffdfc1..96d04f7 100644 --- a/Tools/VehiclePipeline/clean_kamaz_source.py +++ b/Tools/VehiclePipeline/clean_kamaz_source.py @@ -205,9 +205,7 @@ def nearest_wheel_bone(obj, wheel_bones): def rig_chassis_objects(chassis_objects, armature, wheel_bones): for obj in chassis_objects: - wheel_bone = nearest_wheel_bone(obj, wheel_bones) - target_bone = wheel_bone if wheel_bone else "Body" - add_full_weight_group(obj, target_bone) + add_full_weight_group(obj, "Body") modifier = obj.modifiers.new("SK_Kamaz_Chassis_Armature", "ARMATURE") modifier.object = armature obj.parent = armature diff --git a/Tools/VehiclePipeline/prepare_vehicle_exports.py b/Tools/VehiclePipeline/prepare_vehicle_exports.py index 5309fda..f5d81e7 100644 --- a/Tools/VehiclePipeline/prepare_vehicle_exports.py +++ b/Tools/VehiclePipeline/prepare_vehicle_exports.py @@ -151,10 +151,14 @@ def create_vehicle_armature(chassis_objects): def parent_chassis_to_armature(chassis_objects, armature): - select_only(chassis_objects) - armature.select_set(True) - bpy.context.view_layer.objects.active = armature - bpy.ops.object.parent_set(type="ARMATURE_NAME") + for obj in chassis_objects: + obj.vertex_groups.clear() + group = obj.vertex_groups.new(name="Body") + if obj.data.vertices: + group.add([vertex.index for vertex in obj.data.vertices], 1.0, "REPLACE") + modifier = obj.modifiers.new("SK_Kamaz_Chassis_Armature", "ARMATURE") + modifier.object = armature + obj.parent = armature def collection_objects(name): diff --git a/VehicleExports/SK_Kamaz_Chassis.fbx b/VehicleExports/SK_Kamaz_Chassis.fbx index 239caf0..859c369 100644 --- a/VehicleExports/SK_Kamaz_Chassis.fbx +++ b/VehicleExports/SK_Kamaz_Chassis.fbx @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:d605f1874237827dbcb94fa4848b7ac225d50ddf31e87d3458ddacceccf0524b +oid sha256:8586c6b38166382c3a93b54f0a04f605044a2d1939dcbf976390bdb059f0e425 size 23394364 diff --git a/VehicleExports/SM_Kamaz_Broom.fbx b/VehicleExports/SM_Kamaz_Broom.fbx index b6d67cf..e34c429 100644 --- a/VehicleExports/SM_Kamaz_Broom.fbx +++ b/VehicleExports/SM_Kamaz_Broom.fbx @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:55fe65b4676999e3e564528f1658a2b50a8bc65690899f69e1e48455cd0a4d26 +oid sha256:485104780abf5f925ca8f134f3021734afc746fa63bbad96b4dab49ee15c9f98 size 135276 diff --git a/VehicleExports/SM_Kamaz_Gruz.fbx b/VehicleExports/SM_Kamaz_Gruz.fbx index 663d40c..39b78ed 100644 --- a/VehicleExports/SM_Kamaz_Gruz.fbx +++ b/VehicleExports/SM_Kamaz_Gruz.fbx @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:4d9a23c9ccd4e26c4ea8bcabb198fbd2ca84e2ba2410558d6b37e25520e759d8 +oid sha256:fb2e9453dded8638fd3331e68d80cfc76e1dcf83d4f65bab6ddc449428d1e31c size 28236 diff --git a/VehicleExports/SM_Kamaz_Kuzov.fbx b/VehicleExports/SM_Kamaz_Kuzov.fbx index 4145645..d97961d 100644 --- a/VehicleExports/SM_Kamaz_Kuzov.fbx +++ b/VehicleExports/SM_Kamaz_Kuzov.fbx @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:40fb241798ef6e43aa4eb95e8744a4d8892815a4ac2fe364bd4c3de64e2c99ff +oid sha256:18e0aca14302b445fda30056368dd94eb92a7497ae5da9c59d4b7e908936d552 size 596476 diff --git a/VehicleExports/SM_Kraz_BladeBucket.fbx b/VehicleExports/SM_Kraz_BladeBucket.fbx index 7318d2e..f131fd4 100644 --- a/VehicleExports/SM_Kraz_BladeBucket.fbx +++ b/VehicleExports/SM_Kraz_BladeBucket.fbx @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:77d6d3bce64e9fc83feca1e134b0111e48a38200f9d4f51e42fddf0e18219ed2 +oid sha256:d7769ec3a6cadf37b72b44a3ea20df74d2131c87d7be2b579ac558bfb8b2f509 size 2701564 diff --git a/VehicleExports/SM_Kraz_BodyForBulk.fbx b/VehicleExports/SM_Kraz_BodyForBulk.fbx index 9937e85..fcb4ccd 100644 --- a/VehicleExports/SM_Kraz_BodyForBulk.fbx +++ b/VehicleExports/SM_Kraz_BodyForBulk.fbx @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:e32f21214ef83f2aa399faae56b86593ddf84fc242ff3000be33425c0a50b20f +oid sha256:c6573b04b2b46bc9470f66ef7f7acbfbb4851461f2ed9e175d4171d5519deb62 size 588268 diff --git a/VehicleExports/unreal_clear_kamaz_physics_asset_report.json b/VehicleExports/unreal_clear_kamaz_physics_asset_report.json new file mode 100644 index 0000000..8ad4465 --- /dev/null +++ b/VehicleExports/unreal_clear_kamaz_physics_asset_report.json @@ -0,0 +1,6 @@ +{ + "mesh": "/Game/MrPlow/Vehicles/Kamaz/SK_Kamaz_Chassis.SK_Kamaz_Chassis", + "beforePhysicsAsset": "/Game/MrPlow/Vehicles/Kamaz/SK_Kamaz_Chassis_PhysicsAsset.SK_Kamaz_Chassis_PhysicsAsset", + "afterPhysicsAsset": null, + "ok": true +} \ No newline at end of file diff --git a/VehicleExports/unreal_import_kamaz_chassis_report.json b/VehicleExports/unreal_import_kamaz_chassis_report.json index baa2017..5d054dc 100644 --- a/VehicleExports/unreal_import_kamaz_chassis_report.json +++ b/VehicleExports/unreal_import_kamaz_chassis_report.json @@ -7,7 +7,7 @@ ], "skeletalMesh": "/Game/MrPlow/Vehicles/Kamaz/SK_Kamaz_Chassis.SK_Kamaz_Chassis", "skeleton": "/Game/MrPlow/Vehicles/Kamaz/SK_Kamaz_Chassis_Skeleton.SK_Kamaz_Chassis_Skeleton", - "physicsAsset": null, + "physicsAsset": "/Game/MrPlow/Vehicles/Kamaz/SK_Kamaz_Chassis_PhysicsAsset.SK_Kamaz_Chassis_PhysicsAsset", "boneNames": [ "SK_Kamaz_Chassis_Armature", "Root", diff --git a/VehicleExports/unreal_inspect_kamaz_playable_setup_report.json b/VehicleExports/unreal_inspect_kamaz_playable_setup_report.json index fa870f6..064c0d5 100644 --- a/VehicleExports/unreal_inspect_kamaz_playable_setup_report.json +++ b/VehicleExports/unreal_inspect_kamaz_playable_setup_report.json @@ -3,59 +3,59 @@ "defaultGameMode": "/Game/MrPlow/Blueprints/BP_KamazGameMode.BP_KamazGameMode_C", "pawnClass": "/Game/MrPlow/Vehicles/Kamaz/BP_Kamaz_Pawn.BP_Kamaz_Pawn_C", "skeletalMesh": "/Game/MrPlow/Vehicles/Kamaz/SK_Kamaz_Chassis.SK_Kamaz_Chassis", - "physicsAsset": "/Game/MrPlow/Vehicles/Kamaz/SK_Kamaz_Chassis_PhysicsAsset.SK_Kamaz_Chassis_PhysicsAsset", + "physicsAsset": null, "movementMassKg": 8500.0, "wheelSetupCount": 10, "wheelSetups": [ { "bone": "Phys_Wheel_FL", "wheelClass": "/Script/mrPlow58.mrPlow58KamazWheelFront", - "offset": "" + "offset": "" }, { "bone": "Phys_Wheel_FR", "wheelClass": "/Script/mrPlow58.mrPlow58KamazWheelFront", - "offset": "" + "offset": "" }, { "bone": "Phys_Wheel_ML1", "wheelClass": "/Script/mrPlow58.mrPlow58KamazWheelRear", - "offset": "" + "offset": "" }, { "bone": "Phys_Wheel_ML2", "wheelClass": "/Script/mrPlow58.mrPlow58KamazWheelRear", - "offset": "" + "offset": "" }, { "bone": "Phys_Wheel_MR1", "wheelClass": "/Script/mrPlow58.mrPlow58KamazWheelRear", - "offset": "" + "offset": "" }, { "bone": "Phys_Wheel_MR2", "wheelClass": "/Script/mrPlow58.mrPlow58KamazWheelRear", - "offset": "" + "offset": "" }, { "bone": "Phys_Wheel_RL1", "wheelClass": "/Script/mrPlow58.mrPlow58KamazWheelRear", - "offset": "" + "offset": "" }, { "bone": "Phys_Wheel_RL2", "wheelClass": "/Script/mrPlow58.mrPlow58KamazWheelRear", - "offset": "" + "offset": "" }, { "bone": "Phys_Wheel_RR1", "wheelClass": "/Script/mrPlow58.mrPlow58KamazWheelRear", - "offset": "" + "offset": "" }, { "bone": "Phys_Wheel_RR2", "wheelClass": "/Script/mrPlow58.mrPlow58KamazWheelRear", - "offset": "" + "offset": "" } ], "boneNames": [