Try   HackMD

Lethal Company 自定義Model模組 紀錄

前言

MyGO Model Mod

最近推朋友玩了Lethal Company,所以又開始玩Lethal Company,然後裝了一堆自定義Model模組(像是Hololive, Valorant),結果居然沒有MyGO模型的模組,所以我決定弄一個來玩 :)

然後發現我根本不會Unity和C#,ㄏㄏ

這篇文章會偏向我製作的過程紀錄

事前準備

  • 3D Model
  • Unity 2022.3.9f1(建議版本)
  • Visual Studio 2022
  • Git

Unity 模型處理

PMX 轉 FBX

MyGO模型

因為我找到的MyGO模型只有PMX檔是全身,FBX檔的頭和身體是兩個檔案,我不會Blender不會合檔案,所以要把PMX轉成FBX

使用 MMD4Mecanim 轉檔

載點

Image Not Showing Possible Reasons
  • The image was uploaded to a note which you don't have access to
  • The note which the image was originally uploaded to has been deleted
Learn More →

Image Not Showing Possible Reasons
  • The image was uploaded to a note which you don't have access to
  • The note which the image was originally uploaded to has been deleted
Learn More →

Image Not Showing Possible Reasons
  • The image was uploaded to a note which you don't have access to
  • The note which the image was originally uploaded to has been deleted
Learn More →

跑完之後點擊你的Model資料夾中的MMD4檔,同意

Image Not Showing Possible Reasons
  • The image was uploaded to a note which you don't have access to
  • The note which the image was originally uploaded to has been deleted
Learn More →

Image Not Showing Possible Reasons
  • The image was uploaded to a note which you don't have access to
  • The note which the image was originally uploaded to has been deleted
Learn More →

然後就會生成FBX檔了

Image Not Showing Possible Reasons
  • The image was uploaded to a note which you don't have access to
  • The note which the image was originally uploaded to has been deleted
Learn More →

設定模型

基本設定

點擊你的FBX檔,右邊會跳出 Inspector

設定 HumanoidCreate From This Model

Apply

Image Not Showing Possible Reasons
  • The image was uploaded to a note which you don't have access to
  • The note which the image was originally uploaded to has been deleted
Learn More →

跑完後,點擊Configure,檢查你的骨架有沒有正確

然後姿勢要呈T字形

弄好就按 Apply

像這邊 Chest 骨架沒有對應到

Image Not Showing Possible Reasons
  • The image was uploaded to a note which you don't have access to
  • The note which the image was originally uploaded to has been deleted
Learn More →

Model Replacement SDK 設定

  • 安裝 Model Replacement SDK

    • Window -> Package Manager

      Image Not Showing Possible Reasons
      • The image was uploaded to a note which you don't have access to
      • The note which the image was originally uploaded to has been deleted
      Learn More →

    • Add package from git URL

      • 貼上這個 連結,點 Add
        Image Not Showing Possible Reasons
        • The image was uploaded to a note which you don't have access to
        • The note which the image was originally uploaded to has been deleted
        Learn More →
  • 套用到你的模型

    • 設面步驟設定完後,把你的 Model 丟進去場景

      選取你的 Model,然後在 ModelReplacementSDK 中選擇 Setup Model

      弄完就會生出兩個物件
      Image Not Showing Possible Reasons
      • The image was uploaded to a note which you don't have access to
      • The note which the image was originally uploaded to has been deleted
      Learn More →

    Image Not Showing Possible Reasons
    • The image was uploaded to a note which you don't have access to
    • The note which the image was originally uploaded to has been deleted
    Learn More →

    • 把你的模型放到正確位置,那個圓形是基準面

      Image Not Showing Possible Reasons
      • The image was uploaded to a note which you don't have access to
      • The note which the image was originally uploaded to has been deleted
      Learn More →

      Image Not Showing Possible Reasons
      • The image was uploaded to a note which you don't have access to
      • The note which the image was originally uploaded to has been deleted
      Learn More →

    • 然後把每個骨頭加上 Rotation Offset

      Image Not Showing Possible Reasons
      • The image was uploaded to a note which you don't have access to
      • The note which the image was originally uploaded to has been deleted
      Learn More →

設定 Project

  • 在 Assets 空白處點右鍵,選 Create -> ModelReplacemectSDK -> Create Project

    Image Not Showing Possible Reasons
    • The image was uploaded to a note which you don't have access to
    • The note which the image was originally uploaded to has been deleted
    Learn More →

  • 接下來把所有你要用的 Model 都綁到 Project

    • 在 Model 的 Inspector 中

      Model Replacement Properties -> Project Properties -> Project

      選擇你剛剛創建的 Project
      Image Not Showing Possible Reasons
      • The image was uploaded to a note which you don't have access to
      • The note which the image was originally uploaded to has been deleted
      Learn More →
  • 綁完後到 Project 物件中,點擊 Build Project

    Image Not Showing Possible Reasons
    • The image was uploaded to a note which you don't have access to
    • The note which the image was originally uploaded to has been deleted
    Learn More →

檔案生成

  • 上面步驟都完成後就會生成模組所需要的 Model 資源了
    Image Not Showing Possible Reasons
    • The image was uploaded to a note which you don't have access to
    • The note which the image was originally uploaded to has been deleted
    Learn More →

寫模組時間

Visual Studio 專案

  • 創建專案,選 Class Library (.NET Framework)

    Image Not Showing Possible Reasons
    • The image was uploaded to a note which you don't have access to
    • The note which the image was originally uploaded to has been deleted
    Learn More →

  • 添加專案需要的 Reference

    對專案名稱點右鍵,Add -> Reference

    詳細添加操作請參考這個影片

    以下是我用到的Reference

    • BepInEx
    • More Suits
    • ModelReplacementAPI
    • 剩下的應該可以在C:\Steam\steamapps\common\Lethal Company\Lethal Company_Data\Managed找到
      Image Not Showing Possible Reasons
      • The image was uploaded to a note which you don't have access to
      • The note which the image was originally uploaded to has been deleted
      Learn More →
  • 專案結構長這樣,詳細程式碼可以到我的 Github Repo 看,照樣造句改就好了
    ModelReplacementAPI.dll 則在這邊下載

    Image Not Showing Possible Reasons
    • The image was uploaded to a note which you don't have access to
    • The note which the image was originally uploaded to has been deleted
    Learn More →

導出 dll 檔

  • 寫完 code 後,先點選你的 bundle 檔案
    在下面 Advanced 的 Build Action 中選擇 Embedded Resource

    這樣你的模組檔案才會嵌入到 dll 檔裡面

    Image Not Showing Possible Reasons
    • The image was uploaded to a note which you don't have access to
    • The note which the image was originally uploaded to has been deleted
    Learn More →

  • 設定完後,點 Build

    然後到指定的地方找到你的 dll 檔

    Image Not Showing Possible Reasons
    • The image was uploaded to a note which you don't have access to
    • The note which the image was originally uploaded to has been deleted
    Learn More →

設定 Thunderstore Mod package

結構如下,可參考

BepInEx
└── plugins
    └── moresuits
        ├── advanced
        │   ├── Model_1.json
        │   └──Model_2.json
        ├── !less-suits.txt
        ├── Model_1.png
        ├── Model_2.png
        └── LCMygoModel.dll
├── icon.png
├── manifest.json
├── manifest.zip
└── README.md

Reference