Jump to content

How To Import Custom Collision in Sonic Generations/Sonic Unleashed

From HedgeDocs
Revision as of 13:51, 2 May 2025 by NextinHKRY (talk | contribs)
Info
This guide uses the following tools:


Part 1 (Creating Collision in Blender)

You'll need a separate model for the collision, while it is possible to use your stage's model files as collision, we still recommend that you create a separate project or model for it. You can specify tags for your collision in Blender, these tags change the properties of the collision mesh in the game. You'll need a special ini file for Havok Converter to change these tags, which you can download here. To apply these tags to your collision model, you have to rename the individual meshes and add a @ followed by the tag name, below is an example of how you can do this in case you want a mesh to have the "Stone" collision tag.

Example of a collision tag in Blender

You can find all the available tags by opening Havok Converter after placing the mentioned ini file in the same folder as the executable. If you want to use the tags for Sonic Unleashed, you'll have to rename the ini file to HavokConverter_Unleashed.ini.

Part 2 (Converting Your Model Into a Collision File)

Open HavokConverter.exe (or HavokConverter_Unleashed.exe if you are converting for Sonic Unleashed), and fill in the following options:

  • Source 3D model files - Your collision model files
  • Output file - Directory which will contain the converted collision (add .phy.hkx in the end of the name)

Now you can click the Convert button and wait.

Part 3 (Importing Your Collision into the Game)

When the conversion process finishes, extract your custom stage's # file, and place the generated .phy.hkx file there. Afterwards, open the respective .stg.xml file:

  • Sonic Generations: Terrain.stg.xml
  • Sonic Unleashed: Stage.stg.xml

You need to edit the collision file information. This is mentioned in the RigidBodyContainer tag. Change its value to your .phy.hkx filename, without the extension. Below is an example for a file name MyCollision.phy.hkx:

<Terrain>
    <RigidBodyContainer>MyCollision</RigidBodyContainer>
    <IsCollisionRender>false</IsCollisionRender>
</Terrain>

Now re-pack this file and replace the original. After booting into the game, you should now notice that your level has working collision. If this is not the case, you can open your level in SonicGLvl and enable the collision mesh through the View menu to see how it got converted.

Warning
While repacking the # archive carries no risks in Sonic Generations, it's very easy to accidentally pack outdated terrain info files in Sonic Unleashed. This can happen if you convert your stage using Hedgehog Converter but forget to unpack the updated # archive back into your already-extracted folder. As a result, outdated files can overwrite Hedgehog Converter's output, potentially breaking your level. To avoid this, it's highly recommended that you modify the # archive by opening the level in SonicGLvl, editing the data folder inside SonicGLvl's cache, and saving your changes using Save Stage Data.
Cookies help us deliver our services. By using our services, you agree to our use of cookies.