Rebuild KAMAZ rig without ragdoll physics

This commit is contained in:
krustophski 2026-06-18 07:35:36 +03:00
parent 0973c909e4
commit 577c60dab1
15 changed files with 77 additions and 28 deletions

Binary file not shown.

View file

@ -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));

View file

@ -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()

View file

@ -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")

View file

@ -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

View file

@ -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):

BIN
VehicleExports/SK_Kamaz_Chassis.fbx (Stored with Git LFS)

Binary file not shown.

BIN
VehicleExports/SM_Kamaz_Broom.fbx (Stored with Git LFS)

Binary file not shown.

BIN
VehicleExports/SM_Kamaz_Gruz.fbx (Stored with Git LFS)

Binary file not shown.

BIN
VehicleExports/SM_Kamaz_Kuzov.fbx (Stored with Git LFS)

Binary file not shown.

BIN
VehicleExports/SM_Kraz_BladeBucket.fbx (Stored with Git LFS)

Binary file not shown.

BIN
VehicleExports/SM_Kraz_BodyForBulk.fbx (Stored with Git LFS)

Binary file not shown.

View file

@ -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
}

View file

@ -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",

View file

@ -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": "<Struct 'Vector' (0x000002038A8C0C18) {x: 0.000000, y: 0.000000, z: 0.000000}>"
"offset": "<Struct 'Vector' (0x0000021EAA829648) {x: 0.000000, y: 0.000000, z: 0.000000}>"
},
{
"bone": "Phys_Wheel_FR",
"wheelClass": "/Script/mrPlow58.mrPlow58KamazWheelFront",
"offset": "<Struct 'Vector' (0x000002038A8C0BB8) {x: 0.000000, y: 0.000000, z: 0.000000}>"
"offset": "<Struct 'Vector' (0x0000021EAA829438) {x: 0.000000, y: 0.000000, z: 0.000000}>"
},
{
"bone": "Phys_Wheel_ML1",
"wheelClass": "/Script/mrPlow58.mrPlow58KamazWheelRear",
"offset": "<Struct 'Vector' (0x000002038A8C0738) {x: 0.000000, y: 0.000000, z: 0.000000}>"
"offset": "<Struct 'Vector' (0x0000021EAA8293D8) {x: 0.000000, y: 0.000000, z: 0.000000}>"
},
{
"bone": "Phys_Wheel_ML2",
"wheelClass": "/Script/mrPlow58.mrPlow58KamazWheelRear",
"offset": "<Struct 'Vector' (0x000002038A8C0588) {x: 0.000000, y: 0.000000, z: 0.000000}>"
"offset": "<Struct 'Vector' (0x0000021EAA829348) {x: 0.000000, y: 0.000000, z: 0.000000}>"
},
{
"bone": "Phys_Wheel_MR1",
"wheelClass": "/Script/mrPlow58.mrPlow58KamazWheelRear",
"offset": "<Struct 'Vector' (0x000002038A8C03D8) {x: 0.000000, y: 0.000000, z: 0.000000}>"
"offset": "<Struct 'Vector' (0x0000021EAA8291C8) {x: 0.000000, y: 0.000000, z: 0.000000}>"
},
{
"bone": "Phys_Wheel_MR2",
"wheelClass": "/Script/mrPlow58.mrPlow58KamazWheelRear",
"offset": "<Struct 'Vector' (0x000002038A8C0348) {x: 0.000000, y: 0.000000, z: 0.000000}>"
"offset": "<Struct 'Vector' (0x0000021EAA829018) {x: 0.000000, y: 0.000000, z: 0.000000}>"
},
{
"bone": "Phys_Wheel_RL1",
"wheelClass": "/Script/mrPlow58.mrPlow58KamazWheelRear",
"offset": "<Struct 'Vector' (0x000002038A8C0108) {x: 0.000000, y: 0.000000, z: 0.000000}>"
"offset": "<Struct 'Vector' (0x0000021EAA8291C8) {x: 0.000000, y: 0.000000, z: 0.000000}>"
},
{
"bone": "Phys_Wheel_RL2",
"wheelClass": "/Script/mrPlow58.mrPlow58KamazWheelRear",
"offset": "<Struct 'Vector' (0x000002038A8C0078) {x: 0.000000, y: 0.000000, z: 0.000000}>"
"offset": "<Struct 'Vector' (0x0000021EAA829348) {x: 0.000000, y: 0.000000, z: 0.000000}>"
},
{
"bone": "Phys_Wheel_RR1",
"wheelClass": "/Script/mrPlow58.mrPlow58KamazWheelRear",
"offset": "<Struct 'Vector' (0x000002038A8C00D8) {x: 0.000000, y: 0.000000, z: 0.000000}>"
"offset": "<Struct 'Vector' (0x0000021EAA8293D8) {x: 0.000000, y: 0.000000, z: 0.000000}>"
},
{
"bone": "Phys_Wheel_RR2",
"wheelClass": "/Script/mrPlow58.mrPlow58KamazWheelRear",
"offset": "<Struct 'Vector' (0x000002038A8C0318) {x: 0.000000, y: 0.000000, z: 0.000000}>"
"offset": "<Struct 'Vector' (0x0000021EAA829468) {x: 0.000000, y: 0.000000, z: 0.000000}>"
}
],
"boneNames": [