How To Import Custom Collision in Sonic Generations/Sonic Unleashed: Difference between revisions
No edit summary |
No edit summary |
||
Line 1: | Line 1: | ||
{{Notice|type=info|content=This guide uses the following tools: | {{Notice|type=info|content=This guide uses the following tools: | ||
* [[ | * [[Havok Converter]] | ||
* [https://www.blender.org Blender] | * [https://www.blender.org Blender] | ||
* [[HedgeArcPack]]}} | * [[HedgeArcPack]] | ||
* [[SonicGLvl]]}} | |||
== Part 1 (Creating Collision in Blender) == | == 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 a collision, we still recommend that you create a separate project/model for it, even if it's a copy of it. | You'll need a separate model for the collision. While it is possible to use your stage's model files as a collision, we still recommend that you create a separate project/model for it, even if it's a copy of it. | ||
It is possible to specify tags for your collision, which control the type of collision it has. For this, you'll need a special | It is possible to specify tags for your collision, which control the type of collision it has. For this, you'll need a special INI file for Havok Converter with tags. You can download it [https://gist.github.com/TheExentist151/8e4896b807d49cd86ff2b643d34c7aa2 here]. To apply these tags to your collision model, you can simply rename the meshes and add the tag as a prefix to its name. Below is an example of how you can do this, in case you want a mesh to have the "Stone" collision tag: | ||
[[File:Collision tag example blender.png|center|thumb|385x385px|Example of a collision tag in Blender]] | [[File:Collision tag example blender.png|center|thumb|385x385px|Example of a collision tag in Blender]] | ||
You can find all the available tags by opening | You can find all the available tags by opening Havok Converter after placing the mentioned INI file in the same folder as its executable. If you want to use the tags for Sonic Unleashed, you'll have to rename the INI file to <code>HavokConverter_Unleashed.ini</code>. | ||
== Part 2 (Converting Your Model Into a Collision File) == | == Part 2 (Converting Your Model Into a Collision File) == | ||
Open <code>HavokConverter.exe</code> and fill the following options: | Open <code>HavokConverter.exe</code> (or <code>HavokConverter_Unleashed.exe</code> if you are converting for Sonic Unleashed), and fill in the following options: | ||
* Source 3D model files - Your collision model files | * '''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) | * '''Output file''' - Directory which will contain the converted collision (add <code>.phy.hkx</code> in the end of the name) | ||
[[File:Havok converter window.png|center|thumb|730x730px]] | [[File:Havok converter window.png|center|thumb|730x730px]] | ||
Now you can click the | Now you can click the '''Convert''' button and wait. | ||
== Part 3 (Importing Your Collision into the Game) == | == Part 3 (Importing Your Collision into the Game) == | ||
When the conversion process finishes, extract your custom stage's <code>#</code> file, and place the generated <code>phy.hkx</code> file there. Afterwards, open the <code>Terrain.stg.xml</code> | When the conversion process finishes, extract your custom stage's <code>#</code> file, and place the generated <code>.phy.hkx</code> file there. Afterwards, open the respective <code>.stg.xml</code> file: | ||
<Terrain> | |||
* Sonic Generations: <code>Terrain.stg.xml</code> | |||
* Sonic Unleashed: <code>Stage.stg.xml</code> | |||
You need to edit the collision file information. This is mentioned in the <code>RigidBodyContainer</code> tag. Change its value to your <code>.phy.hkx</code> filename, without the extension. Below is an example for a file name <code>MyCollision.phy.hkx</code>:<syntaxhighlight lang="xml"><Terrain> | |||
<RigidBodyContainer>MyCollision</RigidBodyContainer> | <RigidBodyContainer>MyCollision</RigidBodyContainer> | ||
<IsCollisionRender>false</IsCollisionRender> | <IsCollisionRender>false</IsCollisionRender> | ||
</Terrain> | </Terrain></syntaxhighlight>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'''.''' | ||
</syntaxhighlight>Now re-pack this file and replace the original. After booting into the game, you should now notice that your level has working collision. | {{Notice|type=warn|content=While repacking the <code>#</code> 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 <code>#</code> 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 <code>#</code> archive by opening the level in [[SonicGLvl]], editing the <code>data</code> folder inside SonicGLvl's cache, and saving your changes using '''Save Stage Data'''.}} |
Revision as of 13:28, 2 May 2025
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 a collision, we still recommend that you create a separate project/model for it, even if it's a copy of it.
It is possible to specify tags for your collision, which control the type of collision it has. For this, you'll need a special INI file for Havok Converter with tags. You can download it here. To apply these tags to your collision model, you can simply rename the meshes and add the tag as a prefix to its name. Below is an example of how you can do this, in case you want a mesh to have the "Stone" collision tag:

You can find all the available tags by opening Havok Converter after placing the mentioned INI file in the same folder as its 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.
#
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.