Skip to content

Collision Editor (Heroes)

Igor Seabra edited this page Aug 7, 2020 · 1 revision

This page will guide you on using Heroes Power Plant's Collision Editor for working with stage collision models for Sonic Heroes.

Collision Editor

Press F4 or open it from the Editors menu.

Using the Collision Editor

Stage Collision is contained in cl files in the collisions folder. They are models which tell the game which parts of the stage you can stand on, which are walls etc (the stage models are just for the sights and contain no collision of their own). These files contain a quadtree, a form of data partition which optimizes collision detection during the game. You are able to set a few settings regarding the quadtree when importing new files, but you do not need to understand them fully.

You can open any number of Collision Editor windows at the same time, since each Heroes stage can have up to 3 collision files. These are the possible file names:

  • sLL.cl: normal stage collision.
  • sLL_wt.cl: water collision.
  • sLL_xx.cl: death collision.

Just like with the stage models, some stages use stg instead of s. LL refers to the same level number of the stage's ONE file and BSP models.

The collision editor allows you to import an OBJ file, which will be converted to CL.

  • New: lets you choose an OBJ file to import and a new CL file to save as.
  • Open: opens a CL file and allows you to display or import an OBJ over it.
  • Close: closes the CL file so you can't display or edit it anymore.
  • Force Reload: forces the running game to update the collision file (works mid-game!).
  • Import OBJ: lets you choose an OBJ file to import and overwrite the current CL.

Creating a Collision Model

First, you must create a new collision model.

  • You should start by making a copy of your level's original model, but get rid of details such as plants and complex items that are not supposed to be touchable.
  • You can also add invisible geometry to it.
  • Replace stairs with ramps. Make sure the model is as simple as possible.
  • You do not need to bother with setting, editing or removing materials and textures. All are completely ignored when generating the collision file.
  • Split it into multiple meshes, as this division will be kept in the file. The division can be arbitrary, just don't have your entire model in one single mesh.
  • The whole model (not each mesh) has a maximum size of 65535 vertices and/or triangles.
  • Append one of the following letters to the mesh names (not material names, not texture names!) in your 3D model editor to set up collision flags:
    • _a - water collision (for _wt.CL)
    • _b - bingo slide
    • _i - invisible wall
    • _k - protection barrier (ground-only wall)
    • _l - slippery wall
    • _p - pinball Table
    • _s - stairs
    • _t - triangle jumpable wall
    • _w - wall
    • _x - death collision (for _xx.CL)

Windy Valley in 3ds Max

This image shows the collision file for igorseabra4's Windy Valley stage mod in 3ds Max. You can see the division in multiple stage pieces (some with _s, which correspond to stairs). You can also see the death collision models. (Splines also happen to be visible)

After your collision model is done, export it as OBJ and import it with the Collision Editor. Save it in the mod's collisions folder with the proper name.

  • You can choose the maximum depth of the quadtree or let it be chosen automatically (if using Auto doesn't work, I recommend setting it to 5-8, 10 is the maximum). Higher numbers will enable the game to run smoother, lower numbers will cause framerate drops.
  • Note: if your collision model appears completely black after importing, just open the file again and it should display correctly.
  • If you're looking at _xx (death) or _wt (water) models, normals are reversed, so you should disable culling as the models will show up upside down.
  • As for the Power Flag, it defines a few numbers that are added to the quadtree's settings, we don't know much about what it does. Most of the original files leave it at 0xD so that's what we do.

Once your model is imported and saved, you can check Show Collision or use the X shortcut to display it. The file's quadtree can be displayed as well if Show QuadTree is checked, although there's not too much need for this except maybe for debugging purposes. If you test your model and notice collision is buggy in some parts (such as floor clipping), it's probably because some of your meshes have too many triangles. Try simplifying the mesh, and if you absolutely can't, split it into 2 or more.

Water and Death Collision

After creating the main stage collision, you can also import the collision for death and water (both are optional). To import _xx or _wt, append the appropriate flag to the mesh names, check "flip normals" and set the quadtree depth to 1 or 2 before importing. Add the files with the proper names to the collisions folder.

Notes

  • Bingo and pinball collision flag types will only work in levels which originally had them. The difference between them is that you accelerate much faster and have more control on slides than tables.
  • If you want to experiment a bit, you can also set the flags manually. Export the collision from one of the original CL files to OBJ, import it in 3ds Max and take a look at how meshes are named. You can append the same type of formatting (_WWXXYYZZ, 4 bytes) and the flags will be that. You can play with flags that have not been documented yet with this.