mrPlow58/Docs/KamazImportPipeline.md
2026-07-03 07:06:16 +03:00

46 KiB
Raw Blame History

KAMAZ Blender to Unreal Import Pipeline

Кратко по-русски для следующего агента

Этот файл надо считать главным журналом по импорту техники в проект mrPlow58. Если другой AI-агент продолжает работу, сначала прочитать этот файл целиком, потом уже менять Blender/Unreal/C++.

Главное правило: нельзя просто импортировать красивый mesh и назначить его Chaos Vehicle. Для машины нужны отдельно:

  • физический Chaos rig: простой skeletal mesh, правильный Root, правильные wheel bones, правильный scale;
  • визуальные static meshes: кабина, рама, колёса, кузов, груз, щётки, отвалы, ковши;
  • подвесное оборудование как отдельные модули без физики автомобиля;
  • проверочный скрипт, который не даст использовать плохой skeletal mesh в физике.

Текущий рабочий подход:

  • физика временно взята от рабочей Offroad машины;
  • KAMAZ подключён как визуал без коллизии;
  • колёса KAMAZ вынесены отдельными static meshes и вращаются визуально;
  • KUZOV, GRUZ, broom экспортируются отдельно;
  • старый KAMAZ skeletal mesh пока не использовать для Chaos, потому что у него неправильный scale/оси костей.

Журнал проблем и решений

Проблема: машина улетала в космос

Симптомы:

  • KAMAZ появлялся в PIE;
  • сразу получал большую вертикальную скорость;
  • проваливался, подпрыгивал, улетал вверх;
  • управление могло не работать нормально из-за сломанной физики.

Причина:

  • старый KAMAZ skeletal mesh выглядел нормально, но был плохим для Chaos Vehicle;
  • Root scale = 100, а должен быть 1;
  • wheel bones были в метрах и с перепутанными осями;
  • пример плохой кости: Phys_Wheel_FL = x=-1.08 y=-0.54 z=2.05;
  • ожидаемое значение для UE: примерно x=204 y=-108 z=54 в сантиметрах.

Решение:

  • временно отключили KAMAZ skeletal mesh от физики;
  • взяли стабильный Offroad physics rig;
  • KAMAZ сделали только визуальным StaticMeshComponent с NoCollision;
  • добавили gate-аудит Tools/Unreal/audit_kamaz_chaos_asset_gate.py;
  • настоящий KAMAZ Chaos rig будем подключать только когда audit пройдёт.

Проверка:

  • в логе должно быть Mesh=/Game/Vehicles/OffroadCar/SKM_Offroad;
  • машина не должна улетать;
  • PIE должен позволять ехать.

Проблема: KAMAZ был с кузовом, хотя нужна пустая база

Симптомы:

  • пользователь хотел сначала пустой KAMAZ;
  • в визуале оставались KUZOV и GRUZ;
  • нельзя было отдельно проверять модули.

Причина:

  • первый экспорт дублировал все видимые mesh-объекты из Blender.

Решение:

  • создан Tools/VehiclePipeline/export_kamaz_modular_assets.py;
  • из SM_Kamaz_Chassis_Empty исключаются KUZOV, GRUZ, broom;
  • эти объекты экспортируются отдельными FBX:
    • SM_Kamaz_Kuzov.fbx
    • SM_Kamaz_Gruz.fbx
    • SM_Kamaz_Broom.fbx

Проверка:

  • в VehicleExports/kamaz_modular_export_report.json у chassis сейчас sourceObjectCount = 38;
  • KUZOV, GRUZ, broom должны быть в секции modules;
  • в Unreal assets должны лежать в /Game/MrPlow/Vehicles/KamazModular.

Проблема: колёса были частью шасси и не вращались

Симптомы:

  • машина ехала, но визуальные колёса не крутились;
  • колёса могли висеть или быть “запечены” в chassis mesh.

Причина:

  • пустое шасси сначала экспортировалось вместе с колёсами;
  • у визуальных колёс не было отдельных компонентов.

Решение:

  • экспортёр теперь ищет wheel objects по именам tyre, tire, disk, kolpak;
  • колёса группируются по реальным координатам осей;
  • создаются отдельные FBX:
    • SM_Kamaz_Wheel_FL.fbx
    • SM_Kamaz_Wheel_FR.fbx
    • SM_Kamaz_Wheel_ML.fbx
    • SM_Kamaz_Wheel_MR.fbx
    • SM_Kamaz_Wheel_RL.fbx
    • SM_Kamaz_Wheel_RR.fbx
  • в C++ добавлены 6 visual wheel components;
  • они NoCollision;
  • вращаются по GetForwardSpeed().

Проверка:

  • в PIE колёса должны вращаться;
  • пользователь проверил: правые колёса крутились правильно, левые назад;
  • исправлено: все колёса теперь используют один знак вращения.

Проблема: нет текстур/материалы серые

Симптомы:

  • импортированные KAMAZ static meshes выглядят серыми;
  • старые материалы частично есть, но новые static meshes их не получают автоматически.

Причина:

  • текущий импорт intentionally делает import_materials = False и import_textures = False;
  • это было сделано, чтобы не плодить мусорные материал-ассеты на этапе физики.

Решение:

  • создан Tools/Unreal/inspect_kamaz_modular_material_slots.py;
  • создан Tools/Unreal/assign_kamaz_modular_materials.py;
  • материал-слоты у static meshes сохранили имена из Blender, например Rubber, silver, Base, glass;
  • скрипт назначает материалы из:
    • /Game/MrPlow/Vehicles/Kamaz/Materials
    • /Game/MrPlow/Vehicles/Kamaz/Materials/Source
  • если материал отсутствует, создаётся fallback M_KamazSrc_*;
  • для gruz и glass_number fallback-материалы были созданы автоматически;
  • отчёт назначения пишется в VehicleExports/unreal_assign_kamaz_modular_materials_report.json.

Команда:

& "C:\Program Files\Epic Games\UE_5.8\Engine\Binaries\Win64\UnrealEditor-Cmd.exe" `
  "C:\Users\post\Documents\mrPlow\mrPlow58\mrPlow58.uproject" `
  -run=pythonscript `
  -script="C:\Users\post\Documents\mrPlow\mrPlow58\Tools\Unreal\assign_kamaz_modular_materials.py" `
  -unattended -nop4 -nosplash

Проверка:

  • кабина должна быть оранжевая;
  • резина чёрная;
  • диски/металл серые или металлические;
  • стекло отдельным материалом;
  • модули KUZOV/GRUZ/broom должны сохранять свои материалы отдельно.
  • в отчёте не должно остаться WorldGridMaterial на KAMAZ modular meshes.

Проблема: визуальные колёса чуть в земле

Симптомы:

  • машина едет стабильно;
  • колёса визуально немного утоплены в дорожное покрытие;
  • особенно заметно сбоку на задних мостах.

Причина:

  • текущая физика временно использует Offroad rig;
  • визуальные KAMAZ колёса выставлены по реальным координатам KAMAZ, но физическая посадка pawn проседает после старта PIE;
  • в логе видно, что actor после SpawnSnap опускается на подвеске: например Z=526 в BeginPlay, затем около Z=497 в Tick.

Решение:

  • добавлена константа KamazWheelVisualLiftCm = 14.0f в Source/mrPlow58/Kamaz/mrPlow58KamazCar.cpp;
  • подняты только visual wheel components;
  • физика не менялась, потому что это визуальная проблема текущего baseline.

Проверка:

  • пересобрать C++;
  • перезапустить Unreal Editor или обновить C++ через корректный hot reload;
  • открыть Lvl_Kamaz;
  • проверить сбоку, что нижняя часть шин не уходит в дорогу;
  • если всё ещё низко, менять только KamazWheelVisualLiftCm малыми шагами по 3-5 см.

Проблема: VSM Non-Nanite warning

Симптом:

  • сверху в PIE появляется предупреждение: [VSM] Non-Nanite Marking Job Queue overflow

Причина:

  • KAMAZ visual mesh тяжёлый и non-Nanite;
  • много деталей попадает в virtual shadow map.

Решение, которое ещё надо сделать:

  • включить Nanite для тяжёлых static meshes, если подходит;
  • либо сделать LOD/упрощённые visual meshes;
  • либо снизить shadow cost для мелких деталей;
  • это не ошибка физики и не причина улёта.

Проверка:

  • после оптимизации warning должен исчезнуть или появляться реже;
  • FPS/стабильность редактора должны улучшиться.

Проблема: LoadErrors по external actor карты

Симптом:

  • в логе есть строка про missing dependent package для external actor в Lvl_Kamaz.

Причина:

  • вероятно, один external actor в World Partition ссылается на отсутствующий пакет.

Текущий статус:

  • PIE не падает;
  • машина ездит;
  • это не связано с KAMAZ physics/mesh import.

Решение, которое ещё надо сделать:

  • отдельно проверить World Partition external actors;
  • пересохранить/почистить карту Lvl_Kamaz;
  • не смешивать это с задачей импорта машины.

Правила для будущего импорта любой техники

  1. Сначала экспортировать visual modules отдельно.
  2. Никогда не включать кузов/груз/отвал в physics skeletal mesh автомобиля.
  3. Все visual meshes ставить NoCollision, пока они не нужны как отдельные физические объекты.
  4. Для Chaos Vehicle использовать только skeletal mesh, который прошёл audit:
    • Root scale = 1;
    • wheel bones direct child of Root;
    • координаты wheel bones в сантиметрах UE;
    • оси: X forward, Y right/left, Z up;
    • нет лишней Armature кости со scale 100.
  5. Если машина улетает, сначала смотреть skeleton audit и physics asset, а не крутить torque/spring наугад.
  6. Любую новую проблему и решение дописывать в этот файл в формате:
    • симптом;
    • причина;
    • решение;
    • команда проверки;
    • какие файлы изменены.

This document records the working import process for KAMAZ-style modular trucks in mrPlow58. Keep it updated whenever the pipeline changes.

Goal

Bring a real-size truck into Unreal as a stable Chaos Vehicle, not just as a visible mesh.

The final setup must support:

  • a Chaos physics rig with Root and wheel bones;
  • visual chassis as separate no-collision meshes;
  • swappable modules such as KUZOV, GRUZ, blades, buckets, spreaders, tanks, and bodies;
  • repeatable Blender export and Unreal import scripts;
  • asset verification before using a skeletal mesh for physics.

Current Stable Debug Setup

Current KAMAZ gameplay uses a proven Offroad physics rig and KAMAZ visual meshes separately:

  • Physics skeletal mesh: /Game/Vehicles/OffroadCar/SKM_Offroad
  • Physics asset: /Game/Vehicles/OffroadCar/SKM_Offroad_PhysicsAsset
  • Visual empty chassis: /Game/MrPlow/Vehicles/KamazModular/SM_Kamaz_Chassis_Empty
  • Visual wheels:
    • /Game/MrPlow/Vehicles/KamazModular/SM_Kamaz_Wheel_FL
    • /Game/MrPlow/Vehicles/KamazModular/SM_Kamaz_Wheel_FR
    • /Game/MrPlow/Vehicles/KamazModular/SM_Kamaz_Wheel_ML
    • /Game/MrPlow/Vehicles/KamazModular/SM_Kamaz_Wheel_MR
    • /Game/MrPlow/Vehicles/KamazModular/SM_Kamaz_Wheel_RL
    • /Game/MrPlow/Vehicles/KamazModular/SM_Kamaz_Wheel_RR

This is not the final 6x4 Chaos rig. It is the stable baseline proving that the map, input, GameMode, and vehicle code can drive without launching into the sky.

Why the Old KAMAZ Physics Mesh Failed

The old imported KAMAZ skeletal mesh looked acceptable visually but failed the Chaos asset gate:

  • Root scale was 100, but Chaos vehicle physics expects scale 1.
  • Wheel bone translations were in meter-like values and axes were swapped.
  • Example bad value: Phys_Wheel_FL = x=-1.08 y=-0.54 z=2.05
  • Expected UE centimeter value is approximately: x=204 y=-108 z=54

Result: Chaos computed wheel suspension from invalid bone transforms and launched the vehicle upward.

Do not use a KAMAZ skeletal mesh for vehicle physics until it passes:

& "C:\Program Files\Epic Games\UE_5.8\Engine\Binaries\Win64\UnrealEditor-Cmd.exe" `
  "C:\Users\post\Documents\mrPlow\mrPlow58\mrPlow58.uproject" `
  -run=pythonscript `
  -script="C:\Users\post\Documents\mrPlow\mrPlow58\Tools\Unreal\audit_kamaz_chaos_asset_gate.py" `
  -unattended -nop4 -nosplash

The gate intentionally fails until a correct KAMAZ Chaos rig is exported.

Source Files

Blender source files live in:

C:\Users\post\Documents\mrPlow\in

Current KAMAZ source:

C:\Users\post\Documents\mrPlow\in\kamaz_65115_clean.blend

Generated FBX files go to:

C:\Users\post\Documents\mrPlow\in\exports\kamaz_modular

Export Modular Visual Assets From Blender

Run:

& "C:\Program Files\Blender Foundation\Blender 5.0\blender.exe" --background `
  --python Tools\VehiclePipeline\export_kamaz_modular_assets.py -- `
  --input "C:\Users\post\Documents\mrPlow\in\kamaz_65115_clean.blend" `
  --output-dir "C:\Users\post\Documents\mrPlow\in\exports\kamaz_modular" `
  --report "C:\Users\post\Documents\mrPlow\mrPlow58\VehicleExports\kamaz_modular_export_report.json"

The exporter creates:

  • SM_Kamaz_Chassis_Empty.fbx
  • SM_Kamaz_Wheel_FL.fbx
  • SM_Kamaz_Wheel_FR.fbx
  • SM_Kamaz_Wheel_ML.fbx
  • SM_Kamaz_Wheel_MR.fbx
  • SM_Kamaz_Wheel_RL.fbx
  • SM_Kamaz_Wheel_RR.fbx
  • SM_Kamaz_Kuzov.fbx
  • SM_Kamaz_Gruz.fbx
  • SM_Kamaz_Broom.fbx

Important behavior:

  • KUZOV, GRUZ, and broom are excluded from the empty chassis export.
  • Wheel objects are excluded from the empty chassis export.
  • Wheel meshes are centered around their own wheel axis before export.
  • The report lists which Blender objects were assigned to each wheel.

Import Modular Static Meshes Into Unreal

Run:

& "C:\Program Files\Epic Games\UE_5.8\Engine\Binaries\Win64\UnrealEditor-Cmd.exe" `
  "C:\Users\post\Documents\mrPlow\mrPlow58\mrPlow58.uproject" `
  -run=pythonscript `
  -script="C:\Users\post\Documents\mrPlow\mrPlow58\Tools\Unreal\import_kamaz_modular_static_meshes.py" `
  -unattended -nop4 -nosplash

Destination:

/Game/MrPlow/Vehicles/KamazModular

Current import intentionally disables mesh collision for these visual parts. Vehicle physics must come from the Chaos rig, not the visual meshes.

C++ Vehicle Baseline

Current class:

Source/mrPlow58/Kamaz/mrPlow58KamazCar.cpp

Current strategy:

  • hide the stable physics skeletal mesh in game;
  • attach KAMAZ chassis and wheels as visual UStaticMeshComponents;
  • set all visual components to NoCollision;
  • rotate the six visual KAMAZ wheels using vehicle forward speed;
  • keep KAMAZ modules separate for later attach/swap work.

Log Notes

Current useful log lines:

  • KAMAZ BeginPlay ... Mesh=/Game/Vehicles/OffroadCar/SKM_Offroad ... BodyCount=5
  • This confirms the stable baseline rig is active.

Current non-blocking warnings:

  • [VSM] Non-Nanite Marking Job Queue overflow means the visual meshes are heavy/non-Nanite and may hurt shadow performance.
  • One LoadErrors line mentions a missing external actor dependency in Lvl_Kamaz; it does not currently stop PIE or vehicle driving.

Next Steps

  1. Verify wheel visual direction and height in PIE.
  2. Assign or restore KAMAZ materials on modular static meshes.
  3. Reduce visual mesh cost or enable Nanite where appropriate.
  4. Build a real KAMAZ 6x4 Chaos physics rig with Root scale=1 and wheel bones in UE centimeters.
  5. Run audit_kamaz_chaos_asset_gate.py.
  6. Only after the gate passes, switch KAMAZ physics from Offroad rig to the real KAMAZ rig.

2026-06-18 Clean KAMAZ Chaos Rig Gate

Created a new scripted rig path that does not rely on the old broken KAMAZ skeletal mesh.

New files:

  • Tools/VehiclePipeline/export_kamaz_chaos_rig_fbx.py
  • Tools/Unreal/import_kamaz_chaos_rig_fbx.py
  • Tools/Unreal/audit_kamaz_chaos_rig_asset_gate.py
  • Tools/VehiclePipeline/run_kamaz_chaos_rig_gate.ps1
  • Docs/VehicleImportRunbook.ru.md

Verified command:

powershell -ExecutionPolicy Bypass -File "C:\Users\post\Documents\mrPlow\mrPlow58\Tools\VehiclePipeline\run_kamaz_chaos_rig_gate.ps1"

Result:

  • FBX exported to C:\Users\post\Documents\mrPlow\in\exports\kamaz_chaos_rig\SK_Kamaz_ChaosRig.fbx.
  • Unreal asset imported to /Game/MrPlow/Vehicles/KamazChaosRig/SK_Kamaz_ChaosRig.
  • Gate report: VehicleExports/kamaz_chaos_rig_asset_gate_report.json.
  • Gate passed: Root scale = 1; Body exists; all 6 wheel bones are direct children of Root; wheel bone positions match expected UE centimeters.

Important import lesson:

  • Delete the old mesh/skeleton/physics asset before importing the regenerated rig. Replacing only the mesh can leave an old Skeleton reference pose in Unreal.
  • The current working coordinate rule is Blender XYZ = (UE.Z, UE.X, -UE.Y).
  • Keep visual modules separate from this Chaos physics rig.

2026-06-18 Full Clean Import Rule

User requirement: every vehicle import must start clean. Do not carry old errors, old skeleton poses, old physics assets, or temporary gameplay workarounds into the final pipeline.

Implemented:

  • Tools/Unreal/import_kamaz_modular_static_meshes.py now deletes each old static mesh asset before importing it again.
  • Tools/Unreal/import_kamaz_chaos_rig_fbx.py deletes the old rig mesh, skeleton, and physics asset before import.
  • Tools/VehiclePipeline/run_kamaz_full_clean_import.ps1 runs the complete clean pipeline:
    1. Blender material audit.
    2. Modular visual FBX export.
    3. Modular static mesh import from scratch.
    4. Material assignment.
    5. Clean Chaos rig FBX export.
    6. Clean Chaos rig import from scratch.
    7. Chaos rig gate audit.

Verified command:

powershell -ExecutionPolicy Bypass -File "C:\Users\post\Documents\mrPlow\mrPlow58\Tools\VehiclePipeline\run_kamaz_full_clean_import.ps1"

Verified result:

  • VehicleExports/unreal_import_kamaz_modular_static_meshes_report.json: all modular meshes ok: true.
  • VehicleExports/unreal_assign_kamaz_modular_materials_report.json: materials assigned, no missing material slots.
  • VehicleExports/kamaz_chaos_rig_asset_gate_report.json: ok: true, no failures.

2026-06-18 Clean KAMAZ Runtime Test Setup

User requirement: do not switch the main working KAMAZ pawn to a new physics rig until the new rig is tested cleanly. Keep the stable Offroad-baseline pawn intact.

Implemented:

  • Source/mrPlow58/Kamaz/KamazPhysicsAssetCommandlet.cpp now creates /Game/MrPlow/Vehicles/KamazChaosRig/PA_Kamaz_ChaosRig_Body.
  • The PhysicsAsset is assigned to /Game/MrPlow/Vehicles/KamazChaosRig/SK_Kamaz_ChaosRig.
  • The PhysicsAsset intentionally has only one Root body:
    • box center X=-35, Y=0, Z=125
    • box size X=680, Y=220, Z=120
    • bodyCount=1
    • constraintCount=0
  • Wheel contact remains Chaos wheel traces on bones Phys_Wheel_FL, Phys_Wheel_FR, Phys_Wheel_ML, Phys_Wheel_MR, Phys_Wheel_RL, Phys_Wheel_RR.
  • No separate wheel collision bodies are added to the PhysicsAsset, because overlapping wheel bodies can cause bouncing, falling through the road, or launching.

Added isolated test pawn:

  • Source/mrPlow58/Kamaz/mrPlow58KamazChaosRigTestCar.h
  • Source/mrPlow58/Kamaz/mrPlow58KamazChaosRigTestCar.cpp
  • Unreal Blueprint: /Game/MrPlow/Vehicles/KamazChaosRig/BP_Kamaz_ChaosRig_Test

The test pawn:

  • uses SK_Kamaz_ChaosRig;
  • uses PA_Kamaz_ChaosRig_Body;
  • uses modular visual static meshes with NoCollision;
  • sets 6 Chaos wheel setups by exact bone name;
  • uses KAMAZ mass, engine torque curve, gear ratios, and rear-wheel-drive setup;
  • logs KAMAZ CleanRig BeginPlay and KAMAZ CleanRig Tick;
  • is not assigned to GameMode automatically.

Scripts/reports:

  • Tools/Unreal/create_kamaz_chaos_rig_test_blueprint.py
  • VehicleExports/unreal_create_kamaz_chaos_rig_physics_asset_report.json
  • VehicleExports/unreal_create_kamaz_chaos_rig_test_blueprint_report.json

The main command Tools/VehiclePipeline/run_kamaz_full_clean_import.ps1 now performs 10 steps by default:

  1. Blender material audit.
  2. Modular visual export.
  3. Modular static mesh import from scratch.
  4. Modular material assignment.
  5. Clean Chaos rig export.
  6. Clean Chaos rig import from scratch.
  7. Chaos rig gate audit.
  8. C++ build.
  9. PhysicsAsset commandlet.
  10. Clean-rig test Blueprint creation.

Fast import-only mode is available:

powershell -ExecutionPolicy Bypass -File "C:\Users\post\Documents\mrPlow\mrPlow58\Tools\VehiclePipeline\run_kamaz_full_clean_import.ps1" -SkipRuntimeSetup

Next verification:

  • Open Lvl_Kamaz.
  • Place /Game/MrPlow/Vehicles/KamazChaosRig/BP_Kamaz_ChaosRig_Test manually for testing, or temporarily assign it only in a duplicate/test level.
  • Run PIE.
  • Confirm the vehicle does not jump, fall through, or launch.
  • Confirm Output Log contains KAMAZ CleanRig BeginPlay.
  • If it fails, debug in this order: skeleton gate report, PhysicsAsset report, pawn mesh/physics asset paths, wheel bone names.

Follow-up fix during verification:

  • First full 10-step rerun failed only on step 10 because BP_Kamaz_ChaosRig_Test already existed and Unreal was running unattended.
  • Fixed Tools/Unreal/create_kamaz_chaos_rig_test_blueprint.py so it reuses the existing Blueprint, updates input actions, compiles, and saves.
  • Re-ran the full command successfully. This confirms the clean KAMAZ pipeline is repeatable from Blender export through Unreal runtime test asset setup.

2026-06-19 Old KAMAZ Still Spawned In PIE

Symptom:

  • PIE showed two KAMAZ vehicles.
  • One was the player-controlled old Offroad-baseline pawn.
  • One was a manually placed BP_Kamaz_ChaosRig_Test, spawned high in the air and falling.

Log evidence:

  • KAMAZ BeginPlay ... Mesh=/Game/Vehicles/OffroadCar/SKM_Offroad
  • KAMAZ CleanRig BeginPlay ... Mesh=/Game/MrPlow/Vehicles/KamazChaosRig/SK_Kamaz_ChaosRig
  • The clean rig actor location was around Z=7420, so it was not spawned by the corrected GameMode on the road.

Cause:

  • The map GameMode still pointed to old BP_Kamaz_Pawn.
  • Manual placed test actors were left in the level/editor session.
  • This was a level/GameMode setup problem, not a Blender import or skeleton problem.

Fix:

  • Added Tools/Unreal/setup_kamaz_clean_rig_level.py.
  • Added step 11 to Tools/VehiclePipeline/run_kamaz_full_clean_import.ps1.
  • BP_KamazGameMode now uses /Game/MrPlow/Vehicles/KamazChaosRig/BP_Kamaz_ChaosRig_Test.BP_Kamaz_ChaosRig_Test_C.
  • Tools/Unreal/inspect_kamaz_playable_setup.py now validates the clean rig playable setup.
  • Updated Tools/Unreal/create_kamaz_playable_assets.py so it no longer recreates the old Offroad-baseline KAMAZ pawn.
  • Added spawn safety trace to AmrPlow58KamazChaosRigTestCar so high PlayerStarts are corrected at runtime. This is a map spawn safety guard, not an import or rig workaround.

Verified:

  • C++ build succeeded.
  • VehicleExports/unreal_setup_kamaz_clean_rig_level_report.json: default pawn class is BP_Kamaz_ChaosRig_Test_C.
  • VehicleExports/unreal_inspect_kamaz_playable_setup_report.json: ok: true, 6 wheel setups, no missing wheel bones, clean rig mesh and PhysicsAsset assigned.

2026-06-19 Correct Blender To UE Chaos Rig Export

Root cause of the launch/vertical vehicle problem:

  • The old FBX path imported Root with rotations close to Yaw=-90, Roll=90.
  • Wheel translations looked usable, so the previous gate said ok: true, but Chaos Vehicle physics was solving against a rotated root.
  • Some test variants had correct Root but mirrored wheel bone rotations, which can make left/right wheel visuals rotate inconsistently.

Canonical export rule now used by Tools/VehiclePipeline/export_kamaz_chaos_rig_fbx.py:

  • Blender units: metric, scene.unit_settings.scale_length = 0.01.
  • Store source measurements in UE centimeters.
  • Coordinate conversion: Blender XYZ = (UE.X, -UE.Y, UE.Z).
  • FBX export: axis_forward="X", axis_up="Z".
  • FBX bones: primary_bone_axis="X", secondary_bone_axis="-Y".
  • Root, Body, and all Phys_Wheel_* bone tails point in +X; do not mirror wheel bone tail direction by left/right side.
  • No leaf bones.
  • Root at world origin, identity rotation, scale 1.
  • Wheel bones are direct children of Root at real centimeter positions.

Strict gate now verifies:

  • Root translation is zero.
  • Root rotation is identity.
  • Root scale is 1.
  • Body parent is Root.
  • All six wheel bones exist, are parented to Root, and match expected centimeter locations.
  • Mesh bounds are X-forward: X half-length must be greater than Y half-width.

Current verified report:

  • VehicleExports/kamaz_chaos_rig_asset_gate_report.json: ok: true.
  • Root rotation: approximately Pitch=0, Yaw=0, Roll=0.
  • All wheel bone rotations: approximately identity.
  • Bounds: X half-length about 340 cm, Y half-width about 116.5 cm, Z half-height about 62.15 cm.

Do not reintroduce the old -Z/Y pre-swizzle exporter. If another vehicle is imported, first run the same rig variant gate or reuse this exact export rule.

2026-06-19 Generated Clean Import Level

User rule:

  • Every new vehicle import gets its own generated test level.
  • Do not carry old manually placed cars into the new test.
  • The track can be copied from Lvl_Offroad, but the playable vehicle must come only from GameMode/default pawn.

Implemented:

  • Added Tools/Unreal/create_clean_vehicle_import_level.py.
  • Added Tools/Unreal/setup_kamaz_clean_rig_level.py.
  • Tools/VehiclePipeline/run_kamaz_full_clean_import.ps1 now has 12 default steps:
    1. Blender material audit.
    2. Modular visual export.
    3. Modular static mesh import from scratch.
    4. Modular material assignment.
    5. Clean Chaos rig export.
    6. Clean Chaos rig import from scratch.
    7. Chaos rig gate audit.
    8. C++ build.
    9. PhysicsAsset commandlet.
    10. Clean-rig test Blueprint creation.
    11. Generated import level creation.
    12. Generated import level GameMode setup.

Current generated level:

  • /Game/MrPlow/Maps/VehicleImports/Lvl_Kamaz_ChaosRig_Auto

Verified reports:

  • VehicleExports/unreal_create_clean_vehicle_import_level_report.json: ok: true, detectedVehicleActors: [].
  • VehicleExports/unreal_setup_kamaz_clean_rig_level_report.json: ok: true.
  • Level default pawn class: /Game/MrPlow/Vehicles/KamazChaosRig/BP_Kamaz_ChaosRig_Test.BP_Kamaz_ChaosRig_Test_C.
  • Map check after save: 0 Error(s), 0 Warning(s).

Important UE 5.8 note:

  • Deleting external actors from a World Partition template inside a commandlet can assert in WorldPartition/DataLayerManager.cpp.
  • Because of that, level creation currently does not delete actors by default. Instead it audits for placed vehicle actors.
  • For the current Lvl_Offroad source, the audit found no placed vehicle actors after the filter fix, so the generated test level is clean.

The first version of the audit matched Kamaz against the full actor path. Since the generated map itself is named Lvl_Kamaz_ChaosRig_Auto, that falsely flagged every actor in the level. The filter now checks only actor label, class name, and object name.

Full pipeline rerun:

  • Command: Tools/VehiclePipeline/run_kamaz_full_clean_import.ps1
  • Result: finished successfully.
  • Generated level: /Game/MrPlow/Maps/VehicleImports/Lvl_Kamaz_ChaosRig_Auto.
  • Runbook printed by the script: Docs/VehicleChaosRigRules.ru.md.
  • Latest setup log: Map check complete: 0 Error(s), 0 Warning(s).
  • Remaining log warnings are non-vehicle warnings: optional profiler/PIX DLLs, non-target platform SDKs, Zen restart, and deprecated Unreal Python API.

2026-06-19 Wheel Visual Fix

Symptom:

  • Extra rear wheels appeared.
  • Rear wheels did not visually rotate.
  • Front tire rotated, but rim/bolts stayed still.
  • Front wheels did not visually steer.

Root cause:

  • The visual chassis export still contained wheel parts.
  • The old wheel grouping only matched names containing tyre, tire, disk, or kolpak.
  • Source wheel parts named Object008..Object017 and bolt001..bolt013 stayed in SM_Kamaz_Chassis_Empty, so they looked like duplicate/stationary wheels.
  • Runtime wheel visuals were rotated from vehicle forward speed instead of real per-wheel Chaos data.

Fix:

  • Tools/VehiclePipeline/export_kamaz_modular_assets.py now classifies wheel parts by name and by wheel-like geometry near each real wheel center.
  • VehicleExports/kamaz_modular_export_report.json now records wheelCandidates and chassisRejectedWheelObjectCount.
  • SM_Kamaz_Chassis_Empty source object count dropped from 38 to 22.
  • chassisRejectedWheelObjectCount is 38, meaning wheel details were removed from chassis and exported inside wheel modules.
  • AmrPlow58KamazChaosRigTestCar::Tick now syncs each wheel visual from UChaosVehicleWheel:
    • GetRotationAngle()
    • GetSteerAngle()
    • GetSuspensionOffset()

Verified:

  • C++ build succeeded.
  • Full 12-step clean import succeeded.
  • VehicleExports/kamaz_chaos_rig_asset_gate_report.json: ok: true.
  • VehicleExports/unreal_create_kamaz_chaos_rig_physics_asset_report.json: ok: true.
  • VehicleExports/unreal_create_kamaz_chaos_rig_test_blueprint_report.json: ok: true.
  • VehicleExports/unreal_setup_kamaz_clean_rig_level_report.json: ok: true.
  • Latest map check: 0 Error(s), 0 Warning(s).

2026-06-19 No Discarded Blender Meshes Rule

Correction:

  • The previous idea that Object008..Object017 were removable rubber cover meshes was wrong.
  • They are real wheel details and must move with the wheels.
  • No visible Blender mesh may disappear from export.

Current rule:

  • Every visible Blender mesh must be classified as exactly one of:
    • chassis visual;
    • wheel visual module;
    • swap module.
  • unclassifiedObjects must be empty.
  • discardedObjects must be empty.
  • If a mesh cannot be classified, the exporter must fail.

Verified current KAMAZ classification:

  • sourceMeshObjectCount: 63
  • chassisObjectNames: 22
  • wheelObjectNames: 38
  • moduleObjectNames: 3
  • discardedObjects: 0
  • unclassifiedObjects: 0

Front wheel modules now include the detailed Object### tire geometry:

  • FL: bolt009,disk022,kolpak004,tyre023,Object017
  • FR: Object008,kolpak001,tyre001,bolt001,disk001

New model-preparation rulebook:

  • Docs/VehicleModelPreparationRules.ru.md

2026-06-19 Rear Dual Wheel Visual Offset And Rim Detail

Symptom:

  • Front rim details were partly hidden.
  • Rear dual wheels were too far outward compared with the Blender source.

Root cause:

  • Rear visual wheel modules were attached at the outer physical Chaos wheel center, about Y = +/-108 cm.
  • The visual mesh is a dual-wheel pair. Its origin must be centered between the outer and inner wheels, about Y = +/-92 cm.
  • Full-radius rubber cover meshes named Object008..Object017 hid rim/bolt detail when included in the wheel module.

Fix:

  • Tools/VehiclePipeline/export_kamaz_modular_assets.py now records separate physicalWheelCentersM and visualWheelCentersM.
  • Rear visual centers are now about Y = +/-0.922 m.
  • Rear physical Chaos centers remain about Y = +/-1.085 m.
  • Rubber Object### covers are excluded from both chassis and wheel modules.
  • AmrPlow58KamazChaosRigTestCar attaches rear visual wheel components at about Y = +/-92 cm.

Verified:

  • Full 12-step clean import succeeded.
  • VehicleExports/kamaz_modular_export_report.json:
    • chassis.sourceObjectCount: 22
    • chassisRejectedWheelObjectCount: 38
    • ignoredWheelCoverObjects: 10
    • front wheel modules contain tyre/disk/bolt/kolpak, without Object### covers.
  • VehicleExports/kamaz_chaos_rig_asset_gate_report.json: ok: true.
  • VehicleExports/unreal_setup_kamaz_clean_rig_level_report.json: ok: true.
  • Latest map check: 0 Error(s), 0 Warning(s).

2026-06-19 Correction: Wheel Rim Details Are Not Discarded

This section supersedes the earlier note that Object008..Object017 were excluded from wheel modules. That was wrong.

Current rule:

  • Object008..Object017 are real wheel detail meshes.
  • They must not be discarded.
  • They must not remain in SM_Kamaz_Chassis_Empty.
  • They must be exported inside the matching wheel module so they steer, spin, and move with that wheel.
  • discardedObjects must stay empty.
  • unclassifiedObjects must stay empty.

Current explicit KAMAZ wheel inventory:

FL -> Object017, bolt009, disk022, kolpak004, tyre023
FR -> Object008, bolt001, disk001, kolpak001, tyre001
ML -> Object015, Object016, bolt012, disk020, disk021, tyre021, tyre022
MR -> Object009, Object014, bolt010, disk012, disk018, tyre013, tyre019
RL -> Object012, Object013, bolt013, disk016, disk017, tyre017, tyre018
RR -> Object010, Object011, bolt011, disk013, disk014, tyre014, tyre015

Fix:

  • Tools/VehiclePipeline/export_kamaz_modular_assets.py now has EXPECTED_WHEEL_OBJECTS.
  • The exporter fails if any listed wheel detail object is missing or assigned to the wrong wheel group.
  • Tools/VehiclePipeline/inspect_kamaz_wheel_export_geometry.py verifies source .blend objects against exported wheel FBX files.
  • Tools/Unreal/assign_kamaz_modular_materials.py applies a UE PBR readability floor for silver and alumin, because raw Blender diffuse values were too dark for the rim and bolt details to read in-game.

Verification before Unreal import:

VehicleExports/kamaz_modular_export_report.json:
  sourceMeshObjectCount -> 63
  discardedObjects -> 0
  unclassifiedObjects -> 0
VehicleExports/kamaz_wheel_export_geometry_report.json:
  FR includes Object008, bolt001, disk001, kolpak001, tyre001
  each rear wheel module includes two tire/rim shells plus disk/bolt details

Import note:

  • The latest Blender export and FBX geometry verification succeeded.
  • The Unreal commandlet import was blocked because an open UnrealEditor process had the existing SM_Kamaz_*.uasset files locked (Error Code 32).
  • Close PIE/Editor or import through the running editor before rerunning Tools/VehiclePipeline/run_kamaz_full_clean_import.ps1.

Follow-up:

  • After closing UnrealEditor, the full clean import completed successfully.
  • Command: Tools/VehiclePipeline/run_kamaz_full_clean_import.ps1
  • Result: KAMAZ full clean import finished successfully.
  • Visual modules: /Game/MrPlow/Vehicles/KamazModular
  • Chaos rig: /Game/MrPlow/Vehicles/KamazChaosRig/SK_Kamaz_ChaosRig
  • Test pawn blueprint: /Game/MrPlow/Vehicles/KamazChaosRig/BP_Kamaz_ChaosRig_Test
  • Generated test level: /Game/MrPlow/Maps/VehicleImports/Lvl_Kamaz_ChaosRig_Auto
  • Remaining warnings are non-blocking Unreal/Python deprecation and missing non-Windows SDK warnings.

2026-06-19 Clean No-Hacks Auto Level Rebuild

Final clean rebuild command:

Tools/VehiclePipeline/run_kamaz_full_clean_import.ps1 -BlenderExe "C:\Program Files\Blender Foundation\Blender 5.1\blender.exe" -ImportLevel "/Game/MrPlow/Maps/VehicleImports/Lvl_Kamaz_NoHacks_Auto"

Result:

  • pipeline finished successfully;
  • generated level: /Game/MrPlow/Maps/VehicleImports/Lvl_Kamaz_NoHacks_Auto;
  • generated pawn class assigned by GameMode: /Game/MrPlow/Vehicles/KamazChaosRig/BP_Kamaz_ChaosRig_Test_Run_20260619_200333.BP_Kamaz_ChaosRig_Test_Run_20260619_200333_C;
  • old placed vehicle actors in the generated level: 0;
  • VehicleExports/kamaz_chaos_rig_asset_gate_report.json: ok: true;
  • VehicleExports/unreal_assign_kamaz_modular_materials_report.json: all imported modules ok: true, fallback material count 0;
  • VehicleExports/kamaz_wheel_export_geometry_report.json: FR contains Object008, bolt001, disk001, kolpak001, tyre001;
  • rear axle source object rear axle was split into 174 loose parts: 44 assigned to wheel modules, 130 kept in chassis.

Important correction:

  • Do not rely on the fixed old Blueprint asset BP_Kamaz_ChaosRig_Test during clean import checks.
  • UE commandlet can keep old Blueprint packages alive, so the pipeline creates a fresh BP_Kamaz_ChaosRig_Test_Run_* asset every clean import.
  • The generated map must use the class from VehicleExports/unreal_create_kamaz_chaos_rig_test_blueprint_report.json.

2026-06-19 Collection-Based Wheel Export

The KAMAZ visual exporter now reads Blender collections directly:

  • chassis: MrPlow_Chassis;
  • modules: MrPlow_Modules;
  • wheels: WFL, WFR, WML, WMR, WRL, WRR.

This replaces the fragile automatic rear-axle proximity classifier for the final artist-authored model. The user manually sorted rotating wheel-side parts, including RearAxlePart_*, into the six wheel collections.

Current result:

  • upderlight is part of MrPlow_Chassis;
  • old broom is not a swappable module anymore;
  • SM_Kamaz_Broom.fbx is no longer exported;
  • Unreal import deletes stale /Game/MrPlow/Vehicles/KamazModular/SM_Kamaz_Broom;
  • modules are only SM_Kamaz_Kuzov and SM_Kamaz_Gruz;
  • latest generated level: /Game/MrPlow/Maps/VehicleImports/Lvl_Kamaz_Collections_Auto;
  • latest generated pawn: BP_Kamaz_ChaosRig_Test_Run_20260619_214006_C.

2026-07-02 KAMAZ_CR 53605 Chaos Physics Fix

Problem:

  • The new KAMAZ_CR spawned partly below the road and visually looked like it was falling through the surface.
  • The rig import was already clean enough for wheel weights, but the physics asset was not identical to the proven old KAMAZ setup.
  • A body collision attached to a translated Body bone can introduce an extra vertical/transform offset in Chaos.

Rule:

  • For Chaos Vehicle base chassis physics, create the single chassis body on Root, not on Body.
  • Use the same stable root-space chassis collision envelope as the previous working KAMAZ unless a measured replacement is verified in-game.

Current verified KAMAZ_CR physics asset:

Asset: /Game/MrPlow/Vehicles/KAMAZ_CR/ChaosRig/PA_KAMAZ_CR_53605_Body
bodyBone: Root
boxCenterCm: X=-35, Y=0, Z=125
boxSizeCm: X=680, Y=220, Z=120
BodyCount: 1
Mass: 7600 kg
WheelSetups: Phys_Wheel_FL, Phys_Wheel_FR, Phys_Wheel_RL, Phys_Wheel_RR

Verification:

  • KamazCR53605PhysicsAssetCommandlet saves the asset and writes VehicleExports/KAMAZ_CR/unreal_create_kamaz_cr_53605_physics_asset_report.json.
  • Headless launch of /Game/MrPlow/Maps/VehicleImports/Lvl_KAMAZ_CR_53605_Auto reaches KAMAZ_CR 53605 BeginPlay with the expected physics asset and BodyCount=1.

2026-07-02 KAMAZ_CR Full Scripted Import

Final command:

Tools/VehiclePipeline/run_kamaz_cr_full_clean_import.ps1

Result:

  • full pipeline finished successfully;
  • the script closes the editor, exports from Blender, imports into Unreal, builds C++, creates physics, creates the level, runs a headless smoke test, then opens the level;
  • generated level: /Game/MrPlow/Maps/VehicleImports/Lvl_KAMAZ_CR_53605_CleanAuto;
  • clean hidden Chaos rig: /Game/MrPlow/Vehicles/KAMAZ_CR/ChaosRig/SK_KAMAZ_CR_ChaosRig_53605;
  • physics asset: /Game/MrPlow/Vehicles/KAMAZ_CR/ChaosRig/PA_KAMAZ_CR_53605_Body;
  • visible chassis module: /Game/MrPlow/Vehicles/KAMAZ_CR/Modular/SM_KAMAZ_CR_Chassis_Empty;
  • visible wheel modules: /Game/MrPlow/Vehicles/KAMAZ_CR/Modular/SM_KAMAZ_CR_Wheel_FL, FR, RL, RR;
  • latest smoke test reached BeginPlay, BodyCount=1, Wheels=4, Mass=7600.0, and snapped the pawn onto LandscapeSplineActor_0.

Important rule:

  • Tools/VehiclePipeline/export_kamaz_cr_chaos_proxy_rig.py is the canonical Chaos proxy rig exporter for this vehicle. It runs in Blender background and does not require Blender MCP/socket.
  • Tools/VehiclePipeline/export_kamaz_cr_modular_assets.py must export static visual FBX files with the same FBX axis contract as the proxy rig: axis_forward="X" and axis_up="Z". If static meshes use Blender FBX defaults while the proxy rig uses X/Z, the cab/body visually shifts against the Chaos wheel bones.
  • Do not reuse the old KAMAZ skeleton or visual pawn for KAMAZ_CR. The new vehicle gets its own clean Chaos rig and static visual modules.
  • The skeletal mesh is hidden in game and exists only for Chaos Vehicle physics. The visible vehicle is assembled from static mesh modules attached to the pawn and synchronized from the Chaos wheel state.
  • Wheel visuals must combine steering and spin as explicit axis rotations: steer around UE Z, spin around UE Y. Do not rely on a raw Euler FRotator(Pitch, Yaw, Roll) assignment for final verification.
  • When recreating a stable World Partition level path, delete the generated target .umap, Content/__ExternalActors__/..., and Content/__ExternalObjects__/... before loading the source map. Deleting only external data after loading the source map can leave UE with stale package references and causes dependent package None or Invalid duplicate copies of ExternalActor.
  • Wheel FBX origins must stay at the measured wheel centers used by both the exporter and the pawn:
FL: X=173.79  Y=-99.59  Z=53.72 cm
FR: X=173.79  Y=115.96  Z=53.72 cm
RL: X=-218.06 Y=-84.17  Z=53.72 cm
RR: X=-218.06 Y=100.27  Z=53.72 cm

2026-07-03 correction:

  • the visual offset was caused by a cross-pipeline FL/FR/RL/RR mismatch, not by Chaos runtime itself;
  • runtime logs show BeginPlay, steering and wheel rotation, but they do not directly prove that the static visual modules are on the same side as the proxy rig;
  • Tools/VehiclePipeline/audit_kamaz_cr_pipeline_contract.py is now mandatory before Unreal import and writes VehicleExports/KAMAZ_CR/kamaz_cr_pipeline_contract_audit_report.json;
  • current passing contract:
FL -> tyre001, disk001, kolpak001, bolt001 -> Phys_Wheel_FL
FR -> tyre008, disk007, kolpak003, bolt005 -> Phys_Wheel_FR
RL -> tyre002, disk002, disk003, bolt002, tyre003 -> Phys_Wheel_RL
RR -> tyre007, disk005, disk006, bolt004, tyre006 -> Phys_Wheel_RR

Current clean import reports:

VehicleExports/KAMAZ_CR/kamaz_cr_source_geometry_audit_report.json
VehicleExports/KAMAZ_CR/kamaz_cr_modular_export_report.json
VehicleExports/KAMAZ_CR/kamaz_cr_chaos_proxy_rig_export_report.json
VehicleExports/KAMAZ_CR/kamaz_cr_pipeline_contract_audit_report.json
VehicleExports/KAMAZ_CR/kamaz_cr_chaos_rig_asset_gate_report.json
VehicleExports/KAMAZ_CR/unreal_create_kamaz_cr_53605_physics_asset_report.json
VehicleExports/KAMAZ_CR/unreal_create_kamaz_cr_53605_playable_level_report.json

2026-07-03 KAMAZ_CR front wheel wobble fix

Root cause: front wheel visual FBX origins were computed from the full wheel detail bounds. On this model the front disk/cap/bolt group is asymmetric relative to the tyre, so the full-detail bounds center is not the real axle center. That produced a visible eccentric spin even when Chaos steering and wheel rotation were correct.

Correct rule:

  • wheel physics bones, wheel static FBX origins, and C++ visual rest locations must use the tyre/axle center;
  • decorative wheel details still belong to the wheel FBX, but they must not decide the pivot;
  • Tools/VehiclePipeline/export_kamaz_cr_modular_assets.py uses WHEEL_CENTER_OBJECTS for this gate;
  • the report field centerSourceObjects must show tyre001, tyre008, rear tyre pairs;
  • Tools/VehiclePipeline/audit_kamaz_cr_wheel_pivots.py exists to diagnose this exact issue before import.

Passing wheel centers for the current clean import:

FL tyre center: Blender (1.737898,  0.995899, 0.537175) m -> UE (173.79,  -99.59, 53.72) cm
FR tyre center: Blender (1.737898, -1.159602, 0.537175) m -> UE (173.79,  115.96, 53.72) cm
RL tyre center: Blender (-2.180562, 0.841719, 0.537175) m -> UE (-218.06, -84.17, 53.72) cm
RR tyre center: Blender (-2.180561,-1.002729, 0.537175) m -> UE (-218.06, 100.27, 53.72) cm

2026-07-03 KAMAZ_CR attachments and suspension pass

  • AmrPlow58Kamaz53605Car now owns visual attachment components directly, so the new KAMAZ_CR pawn does not need the old KAMAZ modular pawn.
  • Runtime controls:
2 -> toggle KRAZ body for bulk
4 -> toggle KRAZ front blade
Q/E -> blade yaw
,/. -> blade lift down/up
  • 1 is reserved for the native KAMAZ_CR cistern/brush module, but the source CISTERN1 currently exports at about 422 meters wide because its Blender transform/units are not normalized. Do not import it until the source object is corrected.
  • Suspension tuning for visible pitch under throttle/brake:
COM Z: 92 -> 108 cm
Front spring: 140 -> 105, preload 40 -> 55, damping 1.0 -> 0.72
Rear spring: 160 -> 125, preload 45 -> 65, damping 1.0 -> 0.72
Suspension travel: raise 10 -> 18 cm, drop 24 -> 34 cm